True Division in Python

K

kermit

For a long time,, There has been a discussion of trueFor division
versus integer division in Python.


I myslef prefer that / be used for integer division since almost
always, I want the result of the
division be truncated to integer.

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.

Kermit < (e-mail address removed) >
 
T

Terry Reedy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top