469,898 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Remove multiple inheritance in Python 3000

GD
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
Jun 27 '08 #1
18 1493
GD wrote:
Please remove ability to multiple inheritance in Python 3000.
I'm so happy *that's* a dead parrot, all right.

Stefan
Jun 27 '08 #2
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
Jun 27 '08 #3
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
Jun 27 '08 #4
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

Jun 27 '08 #5
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.

Jun 27 '08 #6
On Apr 22, 7:30 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
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.

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
Jun 27 '08 #7
On Apr 22, 10:22*am, Carl Banks <pavlovevide...@gmail.comwrote:
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
Jun 27 '08 #8
On Apr 22, 10:36 am, George Sakkis <george.sak...@gmail.comwrote:
On Apr 22, 10:22 am, Carl Banks <pavlovevide...@gmail.comwrote:
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. 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
Jun 27 '08 #9
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
Jun 27 '08 #10
Carl Banks a écrit :
On Apr 22, 10:36 am, George Sakkis <george.sak...@gmail.comwrote:
>On Apr 22, 10:22 am, Carl Banks <pavlovevide...@gmail.comwrote:
>>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.
Jun 27 '08 #11
On Apr 22, 11:10 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
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
Jun 27 '08 #12
Carl Banks schrieb:
On Apr 22, 11:10 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
>>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.
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
Jun 27 '08 #13
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
Jun 27 '08 #14
On Apr 22, 1:07 pm, GD <gmarke...@gmail.comwrote:
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???

Jun 27 '08 #15
sturlamolden wrote:
On Apr 22, 1:07 pm, GD <gmarke...@gmail.comwrote:
>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???
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/

Jun 27 '08 #16
sturlamolden wrote:
On Apr 22, 1:07 pm, GD <gmarke...@gmail.comwrote:
>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.

Jun 27 '08 #17
On Apr 25, 2:03 pm, Bjoern Schliessmann <usenet-
mail-0306.20.chr0n...@spamgourmet.comwrote:
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.

Jun 27 '08 #18
Nick Stinemates <ni**@stinemates.orgwrites 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
Jun 27 '08 #19

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Hung Jung Lu | last post: by
3 posts views Thread by Taki Jeden | last post: by
20 posts views Thread by km | last post: by
14 posts views Thread by beliavsky | last post: by
16 posts views Thread by devicerandom | last post: by
reply views Thread by Guido van Rossum | last post: by
10 posts views Thread by Aaron Gray | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.