
I think this should produce the same thing as D.f, that means implementation-wise f.__get__(None,D) should be called not f.__get__(D,D). _.__get__(None,D) would still do the right thing for static AND class methods:

[Samuele]
Really? It makes no sense either way though. super(D, D) only makes sense from inside a class method; there the first argument should be the current class and the second should be the cls argument to the class method, e.g.: class C(object): def cm(cls): pass cm = classmethod(cm) class D(C): def cm(cls): super(D, cls).cm() # ~Same as C.cm(cls) And this works. I should also mention that super() should really only be used to call a method with the same name as the currently called method -- I see no use case for using super() with another method.
It shouldn't be terribly hard to detect this situation and fix it (somewhere in super_init()) but unless you have a use case I'd rather consider this as a "don't care" situation. --Guido van Rossum (home page: http://www.python.org/~guido/)

From: "Guido van Rossum" <guido@python.org>
It was sloppy phrased, super(D,D).f should return the same value as C.f, that means an unbound method like D.f.
you mean C.cm()
no, but passing D,D even to classmethods __get__ is working but conceptually bogus, btw the clarifying example Python impl for super semantics at http://www.python.org/2.2.2/descrintro.html#cooperation is broken wrt to classmethods.

[Samuele]
Really? It makes no sense either way though. super(D, D) only makes sense from inside a class method; there the first argument should be the current class and the second should be the cls argument to the class method, e.g.: class C(object): def cm(cls): pass cm = classmethod(cm) class D(C): def cm(cls): super(D, cls).cm() # ~Same as C.cm(cls) And this works. I should also mention that super() should really only be used to call a method with the same name as the currently called method -- I see no use case for using super() with another method.
It shouldn't be terribly hard to detect this situation and fix it (somewhere in super_init()) but unless you have a use case I'd rather consider this as a "don't care" situation. --Guido van Rossum (home page: http://www.python.org/~guido/)

From: "Guido van Rossum" <guido@python.org>
It was sloppy phrased, super(D,D).f should return the same value as C.f, that means an unbound method like D.f.
you mean C.cm()
no, but passing D,D even to classmethods __get__ is working but conceptually bogus, btw the clarifying example Python impl for super semantics at http://www.python.org/2.2.2/descrintro.html#cooperation is broken wrt to classmethods.
participants (2)
-
Guido van Rossum
-
Samuele Pedroni