super - is (should) it (be) a reserved word?
Christian Tanzer
tanzer at swing.co.at
Tue Oct 10 01:20:18 EDT 2000
Michal Wallace <sabren at manifestation.com> wrote:
> you could also call it __super and then you don't have to put the
> classnames in the __init__ (because python does it for you for
> variables starting with [and not ending with] double underscores):
>
>
> class Pie(Dessert):
> __super = Dessert
> def __init__(self):
> print "pie is a..."
> self.__super.__init__(self)
>
> class BananaCremePie(Pie):
> __super = Pie
> def __init__(self):
> print "banana creme pie is a..."
> self.__super.__init__(self)
If you do that, then you'd better not call one of your classes `_X'
and one of its descendent classes `X' -- if you do, you'll get a name
clash between `_X.__super' and `X.__super'. That name clash leads to
infinite recursion in turn.
Cheers,
Christian
PS: Is that a bug or a feature?
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list