Greg Ewing wrote:
> Guido van Rossum wrote:
>> In the world where cooperative multiple inheritance
>> originated (C++), this would be a static error.
>
> I wasn't aware that C++ had anything resembling super().
> Is it a recent addition to the language?
>
It is much more explicit, but you call the function from the
superclass's namespace:
class B : public A {
public:
void m(void) {
A::m(); // The call to my super
};
};
C++ has no concept of MRO, so "super()" would be completely ambiguous.
In fact, if you try to replicate your code in C++ using a generic M
class (which defines a dummy m method), you'll get such an error from
your compiler: "`M' is an ambiguous base of `C'"
This is very much a dynamic language quirk that you can call out to a
function that may or may not exist, and we should avoid comparing it to
other languages which don't allow it. I agree with Guido that in python,
the reasonable fix is to have a superclass which defines an empty method.
--
Scott Dial
[EMAIL PROTECTED]
[EMAIL PROTECTED]
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com