Python aka. Smalltalk Lite?

Bernhard Herzog herzog at online.de
Mon Feb 14 13:59:47 EST 2000


"Evan Simpson" <evan at 4-am.com> writes:

> Suppose we have...
> 
> class Xyzzy(Spot, The, Looney):
>     def walk_silly(self):
>         return super()
>     walk = walk_silly
> 
> ... what should Xyzzy().walk() do?

Ah. I *knew* I was missing something obvious.

> 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 think it should either (1) always use walk_silly, i.e. the name
associated with the function object, or (2) the attribute name used to
access a method should be stored in the method object so that the
implementation of super can access it.

I'd probably prefer (1). (2) is too much DWIM for my tastes.

> I'd expect it to have to be called as 'super(self)', though.

Yes. super should evaluate to an unbound method object.


-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list