A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-July/067517.html below:

[Python-Dev] Problem with super() usage

[Python-Dev] Problem with super() usage [Python-Dev] Problem with super() usageScott Dial scott+python-dev at scottdial.com
Tue Jul 18 15:10:11 CEST 2006
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
scott at scottdial.com
scodial at indiana.edu
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4