At runtime there is nothing to say that the class hasn't been subclassed again.
example: class A(someclass): def __init__(self): super(self).__init__() do_something() class B(A): """No __init__""" def blah(self): pass When you use class B, how does the super we inheirited from A know where to call? Without the class name in super you end up with infinite recursion. (Which can be kinda fun to watch as it crashes...) Chris On Thu, 03 Feb 2005 12:05:27 -0800 (PST), Kevin Smith <[EMAIL PROTECTED]> wrote: > I like the idea of the super() function, but it doesn't seem to solve > the problem that I'm trying to fix. I don't like hard-coding in calls > to super classes using their names: > > class A(object): > def go(self): > ... > > class B(A): > def go(self): > ... > A.go(self) > > I don't like this because if I ever change the name of 'A', I have to go > through all of the methods and change the names there too. super() has > the same problem, but I'm not sure why. It seems like I should be able > to do: > > class B(A): > def go(self): > ... > super(self).go() > > I can create a super() that does this as follows: > > _super = super > def super(obj, cls=None): > if cls is None: > return _super(type(obj), obj) > return super(cls, obj) > > I guess I'm just not sure why it wasn't done that way in the first place. > > -- > Kevin Smith > [EMAIL PROTECTED] > -- > http://mail.python.org/mailman/listinfo/python-list > -- "It is our responsibilities, not ourselves, that we should take seriously." -- Peter Ustinov -- http://mail.python.org/mailman/listinfo/python-list