[Numpy-discussion] Changing the behavior of (builtins.)round (via the __round__ dunder) to return an integer
shoyer at gmail.com
Wed Apr 13 04:31:06 EDT 2016
On Wed, Apr 13, 2016 at 12:42 AM, Antony Lee <antony.lee at berkeley.edu>
> (Note that I am suggesting to switch to the new behavior regardless of the
> version of Python.)
I would lean towards making this change only for Python 3. This is arguably
more consistent with Python than changing the behavior on Python 2.7, too.
The most obvious way in which a float being surprisingly switched to an
integer could cause silent bugs (rather than noisy TypeErrors) is if the
number is used in division. True division in Python 3 eliminates this risk.
Generally, I agree with your reasoning. It would be unfortunate to be stuck
with this legacy behavior forever.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion