Attack a sacred Python Cow
bronger at physik.rwth-aachen.de
Sat Jul 26 14:40:00 CEST 2008
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
> def cfoo(cls, arg):
> cls.whatever = arg - 1
> 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.
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: torsten.bronger at jabber.rwth-aachen.de
More information about the Python-list