Re: Why Isn't Multiple Inheritance Automatic in Python?

Discussion in 'Python' started by Terry Reedy, Dec 17, 2012.

  1. Terry Reedy

    Terry Reedy Guest

    On 12/17/2012 4:14 AM, Ian Kelly wrote:
    > On Sun, Dec 16, 2012 at 9:30 PM, Nick M. Daly <> wrote:
    >> It's very unlikely that multiple inheritance would go horribly wrong, as
    >> long as classes adopt class-specific argument naming conventions.
    >> However, ever since bug 1683368 [0] was fixed, it's now impossible to
    >> cleanly create arbitrary inheritance trees.

    >
    > No, it isn't. You just code each class to strip out the particular
    > arguments that it uses, and by the time you get up to object, either
    > you've removed all the arguments, or your inheritance tree is buggy.
    > The fix for bug 1683368 means that this latter case is detected and
    > raised as an error.


    In other words, one could say that the fix forces a clean inheritance tree.

    > There was a thread not too long ago about the fact that this fix was
    > recently extended to the __init__ methods of immutable classes,


    Since 3.3.0?
    >>> object.__init__(object(), 1)

    Traceback (most recent call last):
    File "<pyshell#4>", line 1, in <module>
    object.__init__(object(), 1)
    TypeError: object.__init__() takes no parameters
    >>> tuple.__init__(tuple(), 1)
    >>>


    Or were you referring to something else? Or done since?

    > while I'm not convinced that this was the correct thing to do, Terry
    > Reedy pointed out in the issue comments back in 2010 that the proper
    > way to initialize immutable instances is by overriding __new__ rather
    > than __init__, the former of which is still perfectly clean to
    > inherit.


    It seems to me that tuple, etc., should just inherit __init__ from object.

    --
    Terry Jan Reedy
    Terry Reedy, Dec 17, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vla
    Replies:
    30
    Views:
    1,015
    Jerry Coffin
    Jan 25, 2005
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    863
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,764
    Smokey Grindel
    Dec 2, 2006
  4. Nick M. Daly
    Replies:
    0
    Views:
    134
    Nick M. Daly
    Dec 17, 2012
  5. Ian Kelly
    Replies:
    0
    Views:
    140
    Ian Kelly
    Dec 17, 2012
Loading...

Share This Page