On Thu, 06 May 2010 12:40:16 +0200, Richard Lamboj wrote:

> Thank you for the nice sample, but what is with multiple inheritance in
> your sample? I mean the super call. Why not _MyClass.blah(self, arg).

super() should work correctly when you have more complicated multiple 
inheritance, while calling the parent class directly may not.

Of course you can call _MyClass.blah if you prefer, for single 
inheritance it should be good enough.


> What is when i have more then one Class from which i inherite and in
> both are a methode called "blah", but i just want to call one of them
> and not both, becouse they do different things?

super() will not call both, it will call the first method that matches.

Unfortunately, multiple inheritance is complicated. Here is a good 
article on super():

http://www.artima.com/weblogs/viewpost.jsp?thread=236275


And for fairness, here is an article which argues that super() is harmful:

http://fuhm.net/super-harmful/


but really, it seems to me that he is arguing that super() is hard to get 
right, not harmful, and that is not because super() is hard, but because 
multiple inheritance is hard.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to