[issue4707] round(25, 1) should return an integer, not a float

Mark Dickinson report at bugs.python.org
Wed Jan 28 10:40:20 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Apologies for the poor formatting in the last comment.  Bad
cut-and-paste job.

One more reason:

(4) "In the face of ambiguity, refuse the temptation to guess."
Why should round(int, int) be float, rather than Decimal, or Fraction?
This was the one argument against the integer division change that I 
found somewhat compelling.  But of course there's a big difference:  1/2 
had to have *some* type, and it couldn't be an integer.  In contrast, 
given that round(34, n) is always integral, there's an obvious choice 
for the return type. 

I'll shut up now.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4707>
_______________________________________


More information about the Python-bugs-list mailing list