ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

Terry Reedy tjreedy at udel.edu
Thu Dec 13 02:36:51 CET 2012


On 12/12/2012 7:30 PM, Steven D'Aprano wrote:
> On Wed, 12 Dec 2012 17:20:53 -0500, Dave Cinege wrote:
>
>> Isn't super() depreciated?
>
> Heavens no. super() is the recommended way to do inheritance, and the
> *only* way to correctly do multiple inheritance[1].

Indeed. Rather than super() being deprecated, it was made easier to use 
in 3.x by being special cased during compilation. Notice the difference 
of signatures:

2.7: super(type[, object-or-type])
3.3: super([type[, object-or-type]])

"The zero argument form only works inside a class definition, as the 
compiler fills in the necessary details to correctly retrieve the class 
being defined, as well as accessing the current instance for ordinary 
methods."

> [1] Well, technically there's another way: one might reimplement the
> functionality of super() in your own code, and avoid using super() while
> having all the usual joys of reinventing the wheel.

This deeper integration means that it could not be completely 
reimplemented in Python ;-).

-- 
Terry Jan Reedy




More information about the Python-list mailing list