super

Robin Becker robin at jessikat.fsnet.co.uk
Thu Oct 25 17:00:24 CEST 2001


In article <j4hesocakz.fsf at informatik.hu-berlin.de>, Martin von Loewis
<loewis at informatik.hu-berlin.de> writes
>Robin Becker <robin at jessikat.fsnet.co.uk> writes:
>
>> After looking at the 2.2 'features' I started wondering why there isn't
>> a special attribute __super__ to indicate super(self.__class__,self).
>> GvR indicates that as it stands super will likely cause cut and paste
>> errors and gives a hacky workaround, but wouldn't it be easier to have a
>> special attribute?
>
>I think having it use self.__class__ inside would be undesirable; it
>should be super(class_in_which_super_call_occurs, self) instead, no?
>
>The problem here would be that you'd need compile-time computation of
>the class object, which is difficult: the class object hasn't been
>constructed, and you can't statically know what its name is.
>
>Regards,
>Martin
yes you're probably right, seem pretty poor of the parser not to allow
the name of the class to be known in the class scope, but that's python.
I wonder why pascal could do this so easily and pythoneers find it so
hard. Must be that out of date LL(1) technology.
-- 
Robin Becker



More information about the Python-list mailing list