Future division patch available (PEP 238)

Anders J. Munch andersjm at dancontrol.dk
Mon Aug 20 08:39:50 EDT 2001


"Markus Schaber" <markus at schabi.de> wrote in message
news:1526387.fx5fSG56mA at lunix.schabi.de...
> 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.

Right.

> 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 my preference would be to change /, the sooner the better.

- Anders





More information about the Python-list mailing list