Python aka. Smalltalk Lite?

Evan Simpson evan at 4-am.com
Mon Feb 14 01:45:46 CET 2000


Bernhard Herzog <herzog at online.de> wrote in message
news:m3n1p493pg.fsf at greebo.nodomain.de...
> It seems to me that deciding what super should do is quite
> straightforward in Python.
>
> Given e.g.
>
> class Xyzzy(Spot, The, Looney):
>
> def walk_silly(self):
> super()
>
> Then super would evaluate to whatever Xyzzy.walk_silly would evaluate
> to if walk_silly weren't an attribute of Xyzzy.

Suppose we have...

class Xyzzy(Spot, The, Looney):
    def walk_silly(self):
        return super()
    walk = walk_silly

... what should Xyzzy().walk() do?  The name 'walk' is in no way accessible
to the implementation of 'super'.  Apart from that, I suppose if it can
somehow get hold of the method object, 'super' could find the __name__ of
the method and the class to which it's bound, and go from there.  I'd expect
it to have to be called as 'super(self)', though.

Cheers,

Evan @ 4-am





More information about the Python-list mailing list