Attack a sacred Python Cow
Torsten Bronger
bronger at physik.rwth-aachen.de
Sat Jul 26 08:40:00 EDT 2008
Hallöchen!
Steven D'Aprano writes:
> On Sat, 26 Jul 2008 11:08:12 +0200, Nikolaus Rath wrote:
>
>> [...]
>>
>> so 'self' should *automatically* only be inserted in the function
>> declaration, and *manually* be typed for attributes.
>
>
> That idea might have worked many years ago, but not now. The
> problem is, what happens here?
>
> class Foo(object):
> def foo(self, arg):
> self.whatever = arg + 1
> @classmethod
> def cfoo(cls, arg):
> cls.whatever = arg - 1
> @staticmethod
> def sfoo(arg):
> print arg
See <news:874p6fzkkh.fsf at physik.rwth-aachen.de>. It is only added
to non-decorated methods within a class. This implies that you can
switch this mechanism off with a noop decorator.
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: torsten.bronger at jabber.rwth-aachen.de
More information about the Python-list
mailing list