Does Python have Multiple Inheritance ?

A

Aaron Gray

Roy Smith said:
Think of it this way:

Aaron is-a WikipediaUser
Aaron is-a GoogleUser

see, multiple inheritance!

See it this way Aaron is so damb supprised that there is another language
with MI and particularly that it is Python, all order and normal action go
out the window !

Cheers,

Aaron
 
T

Tim Golden

Aaron said:
See it this way Aaron is so damb supprised that there is another language
with MI and particularly that it is Python, all order and normal action go
out the window !

Glad you can see the funny side.

Seriously, though, although Python does indeed support multiple inheritance,
I have the impression from comments over the years that it's used a lot less
than in other languages where it is more of a common idiom. Certainly in my
own (not negligible) use of Python, I've very rarely used it for anything
but the occasional mixin class.

I'll leave others to comment on whether this is indeed so and why
it might be :)

TJG
 
M

Michele Simionato

Seriously, though, although Python does indeed support multiple inheritance,
I have the impression from comments over the years that it's used a lot less
than in other languages where it is more of a common idiom. Certainly in my
own (not negligible) use of Python, I've very rarely used it for anything
but the occasional mixin class.

I'll leave others to comment on whether this is indeed so and why
it might be :)

The reason is that in Python using composition is very easy, so there
is little need for MI
(which is a Good Thing).
 
L

Lawrence D'Oliveiro

In message
The reason is that in Python using composition is very easy, so there
is little need for MI
(which is a Good Thing).

Not to mention duck typing, which does away with the need for inheritance
altogether.
 
S

Steve Holden

Lawrence said:
In message


Not to mention duck typing, which does away with the need for inheritance
altogether.

That seems a somewhat extreme point of view.

regards
Steve
 
L

Larry Bates

Lawrence said:
Hey, I didn't design the language, I just use it. :)

I'm with Steve. Multiple inheritance is still a "good" thing, especially for
mixin-classes. wxPython, for instance, wouldn't be nearly so flexible without it.

-Larry
 
L

Lawrence D'Oliveiro

Larry Bates said:
I'm with Steve. Multiple inheritance is still a "good" thing, especially
for mixin-classes. wxPython, for instance, wouldn't be nearly so flexible
without it.

Sure. But Python doesn't _force_ you to do things that way.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top