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.