[Python-Dev] trunc() (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Fri Jan 25 20:39:17 CET 2008


Raymond Hettinger <python rcn.com> writes:

Go ask a dozen people if they are surprised that int(3.7) returns 3. No one will be surprised (even folks who just use Excel or VB). It is foolhardy to be a purist and rage against the existing art:

Well, for what it's worth, here are MySQL's own two cents:

mysql> create table t (a int); Query OK, 0 rows affected (0.00 sec)

mysql> insert t (a) values (1.4), (1.6), (-1.6), (-1.4); Query OK, 4 rows affected (0.00 sec) Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from t; +------+ | a | +------+ | 1 | | 2 | | -2 | | -1 | +------+ 4 rows in set (0.00 sec)



More information about the Python-Dev mailing list