[Python-ideas] Explicit self argument, implicit super argument

Arnaud Delobelle arno at marooned.org.uk
Tue Nov 20 08:05:51 CET 2007


On Tue, November 20, 2007 1:27 am, Luke Stebbing wrote:
> On 11/19/07, Arnaud Delobelle <arno at marooned.org.uk> wrote:
>> Self being explicit makes it less selfish :)
>> To illustrate, I like that you can do:
>>
>> class Foo(str):
>>     def mybar(self):
>>         class Bar(str):
>>             def madeby(me):
>>                 return "I am %s and I was made by %s" % (me, self)
>>         return Bar
>>
>
> How about:
>
> class Foo(str):
>     def mybar():
>         outer = self
>         class Bar(str):
>             def madeby():
>                 return "I am %s and I was made by %s" % (self, outer)
>         return Bar
>
>
> Luke
>

I suppose, though it's a waste of a cell IMHO ;)

-- 
Arnaud





More information about the Python-ideas mailing list