multiple inheritance super()

Michele Simionato michele.simionato at gmail.com
Sun Jul 31 01:49:49 EDT 2005


Mike Meyer:

> I think you're replying to me, but you didn't include any indication
> so I can't be sure.

Oops, sorry, yes, I was replying to you.

> These two are cases of what I was talking about when I referred to the
> Church-Turing thesis.

Well, let me put it in this way. If a language can implement a
missing feature easily, then you are not really missing a big thing.
And the feature may not be provided by default for sake of semplicity
and/or uniformity of style. For instance Python does not have
repeat-until
loops, case statement, ternary operator, etc. (obviously I am not
advocating to remove multiple inheritance now, I am justing
speculating, talking about an hypotetic new Python-like language).

> Also, I don't see how they make the situation
> you are scared of above any better.

It would discourage some people from some abuses, in the same sense the
absence of repeat-until, case statemente, ternary operator etc are
working right now.

> > 3. think differently and use multimethods
>
> I don't see how that would help at all. You haven't done anything
> about solving the base problem - that getting the methods into my
> classes cleanly needs multiple inheritance. Further, I don't need
> methods that are distinguished based on their arguments - they all
> take a fixed set of arguments, and operate on them and the state of
> the instance. None seem to be candidates for being multimethods. The
> mixin methods tend to provide general functionality, and get used in
> radically different places by the different child classes.
>
> You did miss the one alternative I considered: making the methods of
> Mixin stand-alone functions, and passing them extra arguments instead
> of using attributes of the instance. They would all then look like
> mixin_func(self.foo, self.bar, var, value). I decided that this wasn't
> as readable as inherting the methods.


Uhm? I do not follow you. Multimethods would dispatch according
to the type and would act differently on the childrens, dependending
on their state. Perhaps I would need more information to understand
what
you have in mind.

But at the end my point is "I would not feel much more constrained
in expressivity if I did not have multiple inheritance in Python,
and actually I have found out that the more I use OOP, the less I
use inheritance".

Just curious if others had a similar experience.

         Michele Simionato




More information about the Python-list mailing list