On 06/23/2013 11:50 AM, Steven D'Aprano wrote:
On Sun, 23 Jun 2013 12:04:35 -0600, Ian Kelly wrote:

On Sun, Jun 23, 2013 at 11:36 AM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
On Sun, 23 Jun 2013 11:18:41 -0600, Ian Kelly wrote:

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.

Wait a second... are you saying that the Python developers created an
advanced language feature relating to multiple inheritance, one of the
most complex OOP concepts around, so difficult that most other
languages simply prohibit it completely, and it wasn't instantly and
correctly intuited by every single programmer based only on the name?
Oh my stars, somebody call Ranting Rick, he needs to write a PyWart
post to expose this scandal!!!

Mostly I'm saying that super() is badly named.


What else would you call a function that does lookups on the current
object's superclasses?

Well, I would call it super().  Trouble is, that is not all that super() does.  
Going back to Ian's example:

On 06/23/2013 10:08 AM, Ian Kelly wrote:

class Base1(object):
    def __init__(self, foo, **kwargs):
       super(Base1, self).__init__(**kwargs)

class Base2(object):
    def __init__(self, bar, **kwargs):
       super(Base2, self).__init__(**kwargs)

class Derived(Base1, Base2):
    def __init__(self, **kwargs):
       super(Derived, self).__init__(**kwargs)

Notice how Base1 calls super(), but depending on circumstances, it could by Base2 that super() calls. Surely you are not suggesting that Base2 is therefore an ancestor of Base1?

It's too late to change the name now, but pretending there is no good and valid 
reason for confusion doesn't help.

--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to