super

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Oct 25 05:50:36 EDT 2001


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



More information about the Python-list mailing list