What is the semantics meaning of 'object'?

Ian Kelly ian.g.kelly at gmail.com
Sun Jun 23 13:18:41 EDT 2013


On Sun, Jun 23, 2013 at 11:08 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Sun, Jun 23, 2013 at 10:49 AM, Roy Smith <roy at panix.com> wrote:
>> am I missing something here?
>
> Yes, you're missing that super() does not simply call the base class,
> but rather the next class in the MRO for whatever the type of the
> "self" argument is.  If you write the above as:

Incidentally, although super() is useful, it's not perfect, and this
is one of my grievances with it: that a user can, based upon the name,
draw an inaccurate assumption about what it does without reading or
fully understanding the documentation on it, which might then result
in misusing it.  There might still be some code I wrote out there from
when I first started using Python that looks something like:

    def __init__(self):
        super(Base, self).__init__()
        Mixin.__init__(self)

Which is simply wrong, wrong, wrong.



More information about the Python-list mailing list