Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Remove multiple inheritance in Python 3000

2 views
Skip to first unread message
Message has been deleted

Stefan Behnel

unread,
Apr 22, 2008, 7:09:13 AM4/22/08
to GD
GD wrote:
> Please remove ability to multiple inheritance in Python 3000.

I'm so happy *that's* a dead parrot, all right.

Stefan

Diez B. Roggisch

unread,
Apr 22, 2008, 7:30:36 AM4/22/08
to
GD schrieb:

> Please remove ability to multiple inheritance in Python 3000.
>
> Multiple inheritance is bad for design, rarely used and contains many
> problems for usual users.
>
> Every program can be designed only with single inheritance.

Yes, sure. And that's why Java grew interfaces & it's class-diagrams are
hilariously complex. Because using single inheritance is so much better.

Diez

Stefan Behnel

unread,
Apr 22, 2008, 7:34:39 AM4/22/08
to GD
GD wrote:
> Please remove ability to multiple inheritance in Python 3000.
>
> Multiple inheritance is bad for design, rarely used and contains many
> problems for usual users.


Ah, one more:

"doctor, when I do this, it hurts!"

- "then don't do that!"

Stefan

Cezary Krzyżanowski

unread,
Apr 22, 2008, 8:02:21 AM4/22/08
to
Dnia Tue, 22 Apr 2008 04:07:01 -0700, GD napisał(a):

> Please remove ability to multiple inheritance in Python 3000.
>

Please send me 1 mln $.

I've always wanted to be rich and furthermore, I've got a lot of plans and
ideas how to spend that cash.

> I also published this request at http://bugs.python.org/issue2667

I'll be not publishing the bug, as I don't want to leave trace, so that I
don't have to pay taxes.

With regards,
Cz@rny

Bruno Desthuilliers

unread,
Apr 22, 2008, 8:50:11 AM4/22/08
to
GD a écrit :

> Please remove ability to multiple inheritance in Python 3000.

Please dont.

> Multiple inheritance is bad for design, rarely used and contains many
> problems for usual users.

Don't blame the tool for your unability to use it properly.

> Every program can be designed only with single inheritance.

Every program can be implemented in machine code.

Carl Banks

unread,
Apr 22, 2008, 10:22:12 AM4/22/08
to


I have a couple issues with this, though I wholeheartedly agree with
the sentiment:

1. Java didn't grow interfaces, they were there from the start.

2. Java interfaces solve a different problem than MI (used properly)
does: interfaces are there to make types polymorphic, whereas
inheritance's main use is to share behavior.


Too many people believe polymorphism is the only noble goal of OO. If
that were true, there'd be no reason for multiple inheritance, or
single inheritance for that matter. But in my opinion, minimizing
code redundancy by allowing classes to share behaviors is far more
useful and important. That's why I wholeheartedly favor MI: it allows
classes to share behavior with restraints.

Java (for example) allows a class to share behavior with only one
other class, and that *severely* limits the opportunities to minimize
redundancy.


Carl Banks

George Sakkis

unread,
Apr 22, 2008, 10:36:04 AM4/22/08
to
On Apr 22, 10:22 am, Carl Banks <pavlovevide...@gmail.com> wrote:

> Java (for example) allows a class to share behavior with only one
> other class, and that *severely* limits the opportunities to minimize
> redundancy.

Not really; composition is usually a better way to share functionality
and reduce redundancy than inheritance.

George

Carl Banks

unread,
Apr 22, 2008, 10:55:03 AM4/22/08
to

I should have known this was coming. I disagree: inheritance is a
much better way to share behavior. Use inheritance by default,
composition if you have to. (Or composition when it actually reflects
a composition relationship, and not mere behavior sharing.)

With composition you're burdening the user with having to learn the
shared relationships that ought to be implementation details of the
class. E.g.,

obj.action_style.perform_action()

With inheritance, the user doesn't have to worry about these
relationships.

obj.perform_action()

It's better to isolate complexity (which inheritance does) than to
spread it out (which composition does).


Carl Banks

Diez B. Roggisch

unread,
Apr 22, 2008, 11:10:00 AM4/22/08
to
> I have a couple issues with this, though I wholeheartedly agree with
> the sentiment:
>
> 1. Java didn't grow interfaces, they were there from the start.

I might have expressed myself wrong here - I should have written "needed
to introduce interfaces (right from the start)"

> 2. Java interfaces solve a different problem than MI (used properly)
> does: interfaces are there to make types polymorphic, whereas
> inheritance's main use is to share behavior.

But the *goal* of the polymorphy is mainly to have shared behavior. And
matter of factly e.g. in swing, you use inner classes that implement
most of the behavior you want, and override the few points where you
want differences - and then clumsily delegate to that inner class all
your interface-methods.

Diez

Bruno Desthuilliers

unread,
Apr 22, 2008, 11:18:35 AM4/22/08
to
Carl Banks a écrit :

> On Apr 22, 10:36 am, George Sakkis <george.sak...@gmail.com> wrote:
>> On Apr 22, 10:22 am, Carl Banks <pavlovevide...@gmail.com> wrote:
>>
>>> Java (for example) allows a class to share behavior with only one
>>> other class, and that *severely* limits the opportunities to minimize
>>> redundancy.
>> Not really; composition is usually a better way to share functionality
>> and reduce redundancy than inheritance.
>
> I should have known this was coming. I disagree: inheritance is a
> much better way to share behavior.
>
(snip)

> With composition you're burdening the user with having to learn the
> shared relationships that ought to be implementation details of the
> class. E.g.,
>
> obj.action_style.perform_action()
>
> With inheritance, the user doesn't have to worry about these
> relationships.
>
> obj.perform_action()
>
(snip)
Unless you use composition + delegation (which is a PITA in Java and
close to a no-brainer in Python). In which case this is mostly
transparent to the user code.

Anyway, in Python, inheritence is kind of a special case of
composition+delegation.

Carl Banks

unread,
Apr 22, 2008, 12:26:47 PM4/22/08
to
On Apr 22, 11:10 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> > 2. Java interfaces solve a different problem than MI (used properly)
> > does: interfaces are there to make types polymorphic, whereas
> > inheritance's main use is to share behavior.
>
> But the *goal* of the polymorphy is mainly to have shared behavior.

Not at all. The goal of polymorphism is to have objects of different
types usable in the same situation. Two such classes might share some
behavior, but they don't have to.


Carl Banks

Diez B. Roggisch

unread,
Apr 22, 2008, 1:06:52 PM4/22/08
to
Carl Banks schrieb:

Of course they don't *have* to. Yet very often they do. But I should
have (again) worded that more cautiously.

When doing Java, using interfaces like the ones found in the collection
packages or e.g. HttpServletRequest and such usually leads to the
delegation-pattern I described. The same for swing. Generally, a lot of
code is written that declares first an interface & then some
Impl-classes of that - for the sole purpose of working around the
SI-caveats.

This shaped my viewpoint of interfaces - while on their own useful - as
a necessary crutch to create a MI-like features, that I wanted to
emphasize in this discussion.

Diez

Nick Stinemates

unread,
Apr 24, 2008, 11:26:57 AM4/24/08
to pytho...@python.org
On Tue, Apr 22, 2008 at 04:07:01AM -0700, GD wrote:
> Please remove ability to multiple inheritance in Python 3000.
>
> Multiple inheritance is bad for design, rarely used and contains many
> problems for usual users.
>
> Every program can be designed only with single inheritance.
>
> I also published this request at http://bugs.python.org/issue2667
> --
> http://mail.python.org/mailman/listinfo/python-list

You make strong, compelling arguments............

--
Nick Stinemates (ni...@stinemates.org)
http://nick.stinemates.org

sturlamolden

unread,
Apr 24, 2008, 10:40:43 PM4/24/08
to
On Apr 22, 1:07 pm, GD <gmarke...@gmail.com> wrote:

> Please remove ability to multiple inheritance in Python 3000.

Too late for that, PEPs are closed.

> Multiple inheritance is bad for design, rarely used and contains many
> problems for usual users.
>
> Every program can be designed only with single inheritance.

That's how the Java designers were thinking as well: If MI is allowed,
programmers will suddenly get an irresistible urge to use MI to write
unmaintainable spaghetti code. So let's disallow MI for the sake of
common good. Fortunately, Python is not designed to be fool proof
against fools. If you cannot use MI properly, then don't use that.


> I also published this request athttp://bugs.python.org/issue2667

You reported MI as a bug???

Steve Holden

unread,
Apr 24, 2008, 10:49:59 PM4/24/08
to pytho...@python.org
The eventual disposition was "closed, invalid".

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Bjoern Schliessmann

unread,
Apr 25, 2008, 8:03:55 AM4/25/08
to
sturlamolden wrote:
> On Apr 22, 1:07 pm, GD <gmarke...@gmail.com> wrote:

>> Multiple inheritance is bad for design, rarely used and contains
>> many problems for usual users.
>>
>> Every program can be designed only with single inheritance.
>
> That's how the Java designers were thinking as well: If MI is
> allowed, programmers will suddenly get an irresistible urge to use
> MI to write unmaintainable spaghetti code. So let's disallow MI
> for the sake of common good.

Argumenting like that, *all* programming languages had to be
outlawed. 8)

Regards,


Björn

--
BOFH excuse #391:

We already sent around a notice about that.

sturlamolden

unread,
Apr 25, 2008, 9:34:27 AM4/25/08
to
On Apr 25, 2:03 pm, Bjoern Schliessmann <usenet-
mail-0306.20.chr0n...@spamgourmet.com> wrote:

> > That's how the Java designers were thinking as well: If MI is
> > allowed, programmers will suddenly get an irresistible urge to use
> > MI to write unmaintainable spaghetti code. So let's disallow MI
> > for the sake of common good.
>
> Argumenting like that, *all* programming languages had to be
> outlawed. 8)

James Gosling, grossed by C++ iostreams, also used this argument to
disallow operator overloading in Java (except for the String class).
That is why Python has NumPy and Java does not.

Dieter Maurer

unread,
Apr 28, 2008, 1:10:16 PM4/28/08
to pytho...@python.org
Nick Stinemates <ni...@stinemates.org> writes on Thu, 24 Apr 2008 08:26:57 -0700:

> On Tue, Apr 22, 2008 at 04:07:01AM -0700, GD wrote:
> > Please remove ability to multiple inheritance in Python 3000.

I hope your request will not be followed.

> > Multiple inheritance is bad for design, rarely used and contains many
> > problems for usual users.

Multiple inheritance is very productive by supporting mixin classes.
I use it extensively and get clean code quickly developped.

I hate Java because it does not support multiple inheritance
and forces me to write lots of tedious error prone delegations
to work around this limitation.

Dieter

0 new messages