Attack a sacred Python Cow

Torsten Bronger bronger at physik.rwth-aachen.de
Thu Jul 24 06:47:36 EDT 2008


Hallöchen!

Kay Schluehr writes:

> On 24 Jul., 11:40, Torsten Bronger <bron... at physik.rwth-aachen.de>
> wrote:
>>
>> 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".
>
> And $self2, $self3, ... to the object methods of nested classes
> and $cls2, $cls3, ... to the classmethods of those classes...?

One could surely find ways to realise this.  However, the design
goal should be: Make the frequent case simple, and the rare case
possible.

(Actually, I'm -0 on this anyway because I forget "self" very
seldomly, and you would still have ".self" all over the place.)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger at jabber.rwth-aachen.de



More information about the Python-list mailing list