True Division in Python
Terry Reedy
tjreedy at udel.edu
Wed Dec 6 21:35:29 EST 2006
<kermit at polaris.net> wrote in message
news:1165448464.077200.128340 at n67g2000cwd.googlegroups.com...
> For a long time,, There has been a discussion of trueFor division
> versus integer division in Python.
The discussion and the decision to use // and / were years ago.
> I myslef prefer that / be used for integer division since almost
> always, I want the result of the
> division be truncated to integer.
So use //
> However, today I reviewed the method to be used in Python to get true
> division, and this gave
> me an idea how true division could be implemented without interferring
> with the use of
> / for integer division.
> Use / for integer division
> single slash is the operator for integer division.
> Use ./ for true division.
> period slash is the operator for true division.
Proposing to use / and ./ instead of // and / is a waste of time. Really
Terry Jan Reedy
More information about the Python-list
mailing list