[issue16483] Make int(float('inf')) raise ValueError rather than OverflowError.

Stefan Krah report at bugs.python.org
Sat Nov 17 14:56:40 CET 2012


Stefan Krah added the comment:

I don't particularly like OverflowError in any situation where the
potential overflow is detected *before* it actually happens. This is
another example:

 >>> x = [1]*99999999999999999999
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: cannot fit 'int' into an index-sized integer


So I agree that ValueError is more appropriate, but it may not be worth
fixing it. Closing as "won't fix" sounds fine to me.


A general exception cleanup that reduces the number of exceptions that
a user has to remember is tempting, but should probably be discussed on
python-ideas.

----------
nosy: +skrah

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


More information about the Python-bugs-list mailing list