Multiple dispatch again

Samuele Pedroni pedronis at bluewin.ch
Fri Jan 3 22:03:05 CET 2003


From: "David Mertz" <mertz at gnosis.cx>
> "Samuele Pedroni" <pedronis at bluewin.ch> wrote previously:
> |Damian Conway on his method:
> |"some languages (e.g. CLOS) take a different approach -- breaking the tie
by
> |a recount on the inheritance distance of each argument starting from the
> |left... In the author's opinion, this approach is appalling...
>
> Where did you find this quote?  I don't think I saw it in the POD, but
> maybe I overlooked it.

it's from his Perl6 RFC inspired by his previous work

http://dev.perl.org/rfc/256.html

>
> I think Conway's approach is very Perl-ish:  try to figure out what the
> user was most likely to mean, than execute it willy-nilly.  In that
> sense, he definitely does the -right- thing for the language the module
> is in.  But Python doesn't make such assumptions.

I would agree on that.

> On the other hand, Dylan seems much more bondage-and-discipline than
> Python is.  Covariance/contravariance concerns, and generally an
> obsession with type hierarchies, is not very Pythonic, IMO.

once taken the linearization and cooperative methods' path, what is
reasonable, intuitive and usable change.

>   I wouldn't
> say that raising a descriptive error in case of method ambiguities would
> be totally contrary to a Python attitude... but I think better is a rule
> which simply decides matters for every case, regardless of inheritence
> fussiness.  lexicographic_mro() fills that criterion.
>
> After all, plain inheritence in Python doesn't raise compilation/runtime
> errors if the graph isn't pretty enough--as it does in some languages.
> MRO never blows up.

those were the days <wink>

Python 2.3a1 (#38, Dec 31 2002, 17:53:59) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object): pass
...
>>> class B(object): pass
...
>>> class C(A,B): pass
...
>>> class D(B,C): pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: MRO conflict among bases B, C







More information about the Python-list mailing list