[issue18570] OverflowError in division: wrong message

Mark Dickinson report at bugs.python.org
Mon Jul 29 22:35:33 CEST 2013


Mark Dickinson added the comment:

I'd prefer to keep the current behaviour for int / int with an out-of-range result (i.e., raise OverflowError).  As far as possible, I believe Python should raise an exception rather than return an infinity or nan whenever possible (with exceptions when one or other of the operands was an infinity or nan to begin with).  The math module does this consistently;  but (mostly for historical reasons) the core of Python doesn't have a lot of consistency w.r.t. overflow versus infinities:

Still, my own preference would be to try to move to greater use of exceptions rather than to greater use of 'inf' and 'nan' results.  So if anything, 2**1023 / 2**-3 would ideally raise OverflowError rather than return 'inf'.

Note that 1 / 0 also currently raises an exception rather than returning an infinity.

Agreed that 'long int' should be 'int'.

----------

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


More information about the Python-bugs-list mailing list