[Python-Dev] python and super (original) (raw)
Mark Janssen dreamingforward at gmail.com
Sun Apr 17 04:38:56 CEST 2011
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Apr 14, 2011 at 7:09 AM, Ricardo Kirkner <ricardokirkner at gmail.com> wrote:
I recently stumbled upon an issue with a class in the mro chain not calling super, therefore breaking the chain (ie, further base classes along the chain didn't get called). I understand it is currently a requirement that all classes that are part of the mro chain behave and always call super. My question is, shouldn't/wouldn't it be better, if python took ownership of that part, and ensured all classes get called, even if some class misbehaved?
I get annoyed by this issue as well, in various forms.
It seems like such a discussion would have been resolved by now in the multitude of OOP languages, but I have to say it is quite strange to me that there is no distinction made between IS-A relationship and HAS-A relationships with regard to the issue of Inheritence. Python, confusingly makes no syntactic distinction, and its semantic distinction (through MRO and programmer conventions) seems quite suboptimal and "special-cased". --No fault of anyone's, perhaps it is indeed an unresolved issue within Computer Science.
It should be clear that IS-A inheritance is really trying to say (or should be) that the following set/class (of methods and attributes) is a super-set of its "parent" (--See how the OO lexicon is already confused and mixing metaphors?). In this case, manually calling super() is not only completely redundant but adds various confusions.
With regard to inheritence, I too would like to see automatic calls to super classes in every case were there is a complete sClearly there is utility in the notion of a set-theoretic containment
DISCARDING:: the points are moot and need finer granularity that only the pangaia model can fix.
- Previous message: [Python-Dev] python and super
- Next message: [Python-Dev] python and super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]