"spir" <denis.s...@free.fr> wrote
But calling the method of a superclass from the same method is very, very common.

Yep, for sure; and I was not discussing this actually.
(1) In fact, the whole exchange started when the OP asked how to call 2 different methods on the same object, one beeing defined on on its own class, the other one on the parent class.

No he was asking about calling the supercall version of the same method. Here is the post:

-------------
class Child(Parent):
   def somemethod( self, bla ):
       Parent.somemethod(self,bla)
-------------

It uses somemethod() in both child and parent.

And that is what I am saying is a very common, and desirable, pattern.

I may be coming across a bit strong on this one but it is such a fundamentally important feature of OOP that I feel on a list like tutor it is important to make it clear that this is not only correct behaviour but is very common in practice.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to