super - is (should) it (be) a reserved word?

Glyph Lefkowitz glyph at no.spam
Wed Oct 11 18:35:13 EDT 2000


Alan Gauld <alan.gauld at gssec.bt.co.uk> writes:

> > Pie().Print();
> > 
> > recurses infinitely. You were just lucky to try with only two 
> 
> Which is of course true because self always points to the 
> leaf node....oops!
> 
> Back to the drawing board I guess :-)
> 

Not really, just use self.__super as a previous poster suggested.
(Python mangles the name to self._Dessert__super or self._Pie__super
internally, depending on which method or class it's referred to from)

If the prettier syntax (I.E. fewer underscores) is really what you
want, you can write an accessor method by overriding __getattr__
somewhere to special-case super.

-- 
Glyph Lefkowitz
Professional -- Software Engineer,  Origin Systems
Amateur      -- Computer Scientist, Twisted Matrix Enterprises
(My opinions are my own and do not reflect in any way on the policies
or practices of my employer, etcetera etcetera.)



More information about the Python-list mailing list