proposed language change to int/int==float (was: PEP0238 lament)

Gareth McCaughan Gareth.McCaughan at pobox.com
Mon Jul 23 16:36:21 EDT 2001


Grant Edwards wrote:

> What I don't understand is why polymorphism is all of a sudden
> an evil, nasty thing in the Python world -- something that must
> be banished at all costs (even if we have to change one of the
> basic mathematical operators and break existing programs).
> 
> Are the rulers of the Python Kingdom going to ban all
> polymorphism?  I thought it was one of the _strengths_ of
> Python, and here we are trying to stamp it out!

The different behaviour of "/" on floats and ints isn't
polymorphism, it's overloading. Two different operations.
Closely related, of course, but different. Generally
"polymorphism" is reserved for when what's being done
is "the same thing" in both cases.

Python doesn't generally object much to overloading either,
of course (def __div__(self, x): ...); and I find the
proposed change scary (what I wish is that Python had
made 1/2 give a rational from day 1, but it's too late
for that to happen unless Guido gets the time machine out
again). So I'm just quibbling.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
.sig under construc



More information about the Python-list mailing list