Why does super take a class name as the argument?
Shalabh Chaturvedi
shalabh at cafepy.com
Fri Oct 15 12:05:43 EDT 2004
Chris Green wrote:
. . .
> The reason I'm asking about this is I find myself cursing super every
> time I want to change the name of the class I'm working on when one of
> the reason's that super was implemented (I'm guessing) was to insulate
> derived classes from the name changes of where they inherited from.
Derived classes *are* insulated from name changes of the base classes.
The class in super has to be the same as the class in which the super
call is written (i.e. the one 'around' the super call), not a base
class. So if you change a class name, you only change the super calls
that exist within that class.
Of course, it could be easier with more support from the interpreter
(and it may be in a future version). See also autosuper in Guido's essay [1]
Shalabh
[1] http://www.python.org/2.2.3/descrintro.html
More information about the Python-list
mailing list