[Python-Dev] python and super (original) (raw)
Ricardo Kirkner ricardokirkner at gmail.com
Thu Apr 14 17:48:29 CEST 2011
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Exactly what Michael said. Stopping the chain going upwards is one thing. Stopping it going sideways is another.
On Thu, Apr 14, 2011 at 12:37 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
On 14/04/2011 16:34, P.J. Eby wrote:
At 03:55 PM 4/14/2011 +0100, Michael Foord wrote:
Ricardo isn't suggesting that Python should always call super for you, but when you start the chain by calling super then Python could ensure that all the methods are called for you. If an individual method doesn't call super then a theoretical implementation could skip the parents methods (unless another child calls super). That would break classes that deliberately don't call super. I can think of examples in my own code that would break, especially in init() cases. It's perfectly sensible and useful for there to be classes that intentionally fail to call super(), and yet have a subclass that wants to use super(). So, this change would expose an internal implementation detail of a class to its subclasses, and make "fragile base class" problems worse. (i.e., where an internal change to a base class breaks a previously-working subclass). It shouldn't do. What I was suggesting is that a method not calling super shouldn't stop a sibling method being called, but could still prevent the parent method being called. Michael -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]