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

Luke Stebbing luke.stebbing at gmail.com
Tue Nov 20 02:27:30 CET 2007


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



More information about the Python-ideas mailing list