Attack a sacred Python Cow
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu Jul 24 08:59:26 EDT 2008
Torsten Bronger a écrit :
> Hallöchen!
>
> Bruno Desthuilliers writes:
>
>> [...]
>>
>> How would you handle this case with an implicit 'self' :
>>
>> class Foo(object):
>> pass
>>
>> def bar(self):
>> print self
>>
>> Foo.bar = bar
>
> Just like this. However, the compiler could add "self" to
> non-decorated methods which are defined within "class".
What's defined within classes are plain functions. It's actually the
lookup mechanism that wraps them into methods (and manage to insert the
current instance as first argument).
More information about the Python-list
mailing list