Future division patch available (PEP 238)
Markus Schaber
markus at schabi.de
Thu Aug 16 10:13:27 EDT 2001
Hi,
Anders J. Munch <andersjm at dancontrol.dk> schrub:
> Another option would be to add a new infix operator to the language
> with the same precedence as /. Something with a long clunky name, like
> "__oldstyle_divide__", whose only raison d'ĂȘtre is compatibility
> hacks. Changing
> E1 / E2
> to
> E1 __oldstyle_divide__ E2
> doesn't require deep parsing.
The problem here is that / also is a word delimiter.
so you have to replace a/b with a __oldstyle_divide_ b, inserting
blanks around the operator.
My way would be to let / be as it was, and to import // as a new
operator that returns a float when dividing two integers who don't fit.
And then document this behaviour at famous places.
markus
--
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil. (Grand Edwards in comp.lang.python)
More information about the Python-list
mailing list