IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New as a non python user, whats wrong with the old way?
These miserable swine, having nothing but illusions to live on, marshmallows for the soul in place of good meat, will now stoop to any disgusting level to prevent even those miserable morsels from vanishing into thin air. The country is being destroyed by these stupid, vicious right-wing fanatics, the spiritual brothers of the brownshirts and redstars, collectivists and authoritarians all, who would not know freedom if it bit them on the ass, who spend all their time trying to stamp, bludgeon, and eviscerate the very idea of the individual's right to his own private world. DRL
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Not really wrong, just annoying
...which isn't the best reason to introduce new syntax, but it's going in one way or another.

Here's an example of the old way:

    def frombuf(cls, buf):\n        """Construct a TarInfo object from a 512 byte string buffer.\n        """\n        tarinfo = cls()\n        tarinfo.name   =  nts(buf[0:100])\n        tarinfo.mode   = int(buf[100:108], 8)\n        tarinfo.uid    = int(buf[108:116],8)\n        tarinfo.gid    = int(buf[116:124],8)\n        tarinfo.size   = long(buf[124:136], 8)\n        tarinfo.mtime  = long(buf[136:148], 8)\n        tarinfo.chksum = int(buf[148:156], 8)\n        tarinfo.type   = buf[156:157]\n        tarinfo.linkname = nts(buf[157:257])\n        tarinfo.uname  = nts(buf[265:297])\n        tarinfo.gname  = nts(buf[297:329])\n        try:\n            tarinfo.devmajor = int(buf[329:337], 8)\n            tarinfo.devminor = int(buf[337:345], 8)\n        except ValueError:\n            tarinfo.devmajor = tarinfo.devmajor = 0\n        tarinfo.prefix = buf[345:500]\n\n        # The prefix field is used for filenames > 100 in\n        # the POSIX standard.\n        # name = prefix + '/' + name\n        if tarinfo.type != GNUTYPE_SPARSE:\n            tarinfo.name = normpath(os.path.join(nts(tarinfo.prefix), tarinfo.name))\n\n        # Directory names should have a '/' at the end.\n        if tarinfo.isdir() and tarinfo.name[-1:] != "/":\n            tarinfo.name += "/"\n        return tarinfo\n\n    frombuf = classmethod(frombuf)


Two things are "wrong":

1) The notation that this is a class method is a long way from the declaration of the function itself, and often gets missed when reading source code.

2) One has to type "frombuf" three times. In particular, some integration projects require you to a) wrap functions and b) use extremely long method names.


"Despite the seemingly endless necessity for doing
so, it's actually not possible to reverse-engineer intended invariants
from staring at thousands of lines of code (not in C, and not in
Python code either)."

Tim Peters on python-dev
     Python decorator proposal - (FuManChu) - (10)
         as a non python user, whats wrong with the old way? -NT - (boxley) - (1)
             Not really wrong, just annoying - (FuManChu)
         I don't understand the example :( - (Arkadiy) - (5)
             classmthod - (FuManChu) - (4)
                 A more concrete example from Ruby - (ben_tilly) - (3)
                     Oh, I underrstand class/object methods - (Arkadiy) - (2)
                         You can't do that to builtins yet - (FuManChu)
                         You can do that in Ruby - (ben_tilly)
         An update on the proposed change - (ChrisR) - (1)
             Why, yes, he did. :) - (FuManChu)

Dang a lang, dang a lang.
82 ms