[Python-Dev] trunc()

Facundo Batista facundobatista at gmail.com
Fri Jan 25 18:45:06 CET 2008


2008/1/25, Jeffrey Yasskin <jyasskin at gmail.com>:

> decision comes to be that int(float) should be blessed as a correct
> way to truncate a float, I'd agree with Raymond that trunc() is just
> duplication and should be eliminated. I'd, of course, rather have a
> spelling that says what it means. :)

Mmm... no. int() is a builtin way to transform the builtin data type
float into the builtin data type float.

There's no "correct" way for a float to become an integer, but in the
math module you have several ways to do it (floor, ceil, round, trunc,
choose the one that you want, but you're "notified" <wink/2> that
there're different ways to do it).

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list