super() doesn't get superclass
bignose+hates-spam at benfinney.id.au
Tue Sep 18 07:38:46 CEST 2007
Evan Klitzke <evan at yelp.com> writes:
> If you're using multiple inheritance, and you're _not_ using super
> everywhere, then your code is broken anyway.
This seems to support the notion that 'super' is unusable. If I
inherit from code that isn't under my control, and then use super(),
my code is broken.
Therefore, to avoid writing broken code, I must either never inherit
from code not under my control, or I must never use super(). Since the
former is practically unavoidable, I must choose the latter.
Which, naturally, compounds the problem, since when someone else uses
*my* code, they in turn must conclude that they can't use super().
> Use super correctly in your own code, and you don't need to worry
> about other people using it incorrectly.
As the article points out, when using super(),
you must remember that super does not call your superclass. You
must be prepared to call any other class's method in the hierarchy
and be prepared to be called from any other class's method.
So, the programmer using super() very much *does* need to worry about
other people using it correctly.
\ "Quidquid latine dictum sit, altum viditur." ("Whatever is |
`\ said in Latin, sounds profound.") -- Anonymous |
More information about the Python-list