Mark Dickinson <dicki...@gmail.com> added the comment: For myself, I strongly prefer that round(int, int) return an integer in Python 3.x. Here ar\ e three reasons:
(1) Interoperability with Decimal (and, to a lesser extent, Fraction): the decimal module is\ carefully designed so that Decimals interact well with integers. If round(int, int) return\ s an integer then someone working with Decimals can use round freely, without worrying about\ whether his or her numbers are actually integers or Decimals. If round(int, int) returns a\ float then that someone is likely to get a nasty shock doing round(Decimal, int) when it tu\ rns out that the Decimal was actually just a plain integer. (2) Accuracy: currently, for example, we have >>> round(10**16+1, 0) 10000000000000000.0 If the return type is changed to int, there's no need for this loss of accuracy. (3) Consistency: in 3.x, round(my_decimal, n) returns a Decimal; round(my_fraction, n) ret\ urns a Fraction. That is, for all Python's numeric types other than int, the value returned\ from two-argument round has the same type as the first argument. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4707> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com