Re: Things to know about ‘super’ (was: super() and multiple inheritance failure)
michele.simionato at gmail.com
Sat Sep 26 07:58:32 CEST 2009
On Sep 26, 6:56 am, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Michele Simionato <michele.simion... at gmail.com> writes:
> > You may want to read "Things to know about super":
> Thanks for these articles. Any chance they will appear in a single
> location, so we don't need three separate URLs for them?
Good idea. I have collect them in PDF form here:
> Also, one article passes on this recommendation:
> use super consistently, and document that you use it, as it is part
> of the external interface for your class, like it or not.
(this is a literal citation from "super considered harmful" by James
> So, if use classes coming from a library in a multiple inheritance
> situation, you must know if the classes were intended to be
> cooperative (using super) or not. Library author should always
> document their usage of super.
> I can see lots of ways this fact could be documented, none of them
> terribly concise. It's a simple “yes/no” fact about a class, after all;
> what's the best way of succinctly conveying this information in a world
> where the problem is barely known, let alone the solution?
Difficult question. You know that in an ideal world I would just
away multiple inheritance, it is just not worth the complication.
In the real world, this is how a developer can document his hierarchy
"This hierarchy use super. See http://fuhm.net/super-harmful"
"This hierarchy does not use super. See http://fuhm.net/super-harmful"
That's all that is needed to third party code wanting to inherit from
More information about the Python-list