Things to know about ‘super’ (was: super() and multiple inheritance failure)

Ben Finney ben+python at benfinney.id.au
Sat Sep 26 00:56:36 EDT 2009


Michele Simionato <michele.simionato at gmail.com> writes:

> You may want to read "Things to know about super":
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=236275
> http://www.artima.com/weblogs/viewpost.jsp?thread=236278
> http://www.artima.com/weblogs/viewpost.jsp?thread=237121

Thanks for these articles. Any chance they will appear in a single
location, so we don't need three separate URLs for them?

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.

    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?

-- 
 \       “If trees could scream, would we be so cavalier about cutting |
  `\   them down? We might, if they screamed all the time, for no good |
_o__)                                            reason.” —Jack Handey |
Ben Finney



More information about the Python-list mailing list