Raymond Hettinger added the comment:

> Wouldn't it be more consistent for new-style classes,
> instead of calling "object.__setattr__(self, name, value)",
> to call "super(<ClassName>, self).__setattr__(name, value)"?

That's not always the right thing to do.  Calling object.__setattr__ gives a 
known, guaranteed behavior.   Using super however relies on an MRO calculation 
that may send the super call outside the inheritance tree to a methods that 
wasn't expecting to be called. 

Put another way, super was designed for cooperative multiple inheritance with 
implies an element of coordinated cooperation that isn't always present.

I think the current advice should stand.  We aren't advising people to always 
use super instead of calling a parent class method directly.  Part of the 
reason is that super can be much trickier that people expect.

Also, in Python 2.7 super() doesn't have the same magical but clean invocation 
it has in Python 3.  The two argument form isn't as elegant looking or as easy 
to get right.

----------
assignee: docs@python -> rhettinger
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21814>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to