How to test if object is an integer?

Ian Kelly ian.g.kelly at gmail.com
Mon Oct 17 20:59:44 EDT 2011


On Mon, Oct 17, 2011 at 6:40 PM, Chris Kaynor <ckaynor at zindagigames.com> wrote:
> Python 2.6 running on Windows 7:
>>>> 99.0**99**99
> OverflowError: (34, 'Result too large')
> Traceback (most recent call last):
>   File "<stdin-inspect>", line 1, in <module>
> OverflowError: (34, 'Result too large')
>
> However, from the documentation:
> "Because of the lack of standardization of floating point exception
> handling in C, most floating point operations also aren’t checked."
> (http://docs.python.org/library/exceptions.html#exceptions.OverflowError)

I think what Roy meant was "can you even get an OverflowError from
calling int() any more", to which I think the answer is no, since in
modern Pythons int() will auto-promote to a long, and in Python 3
they're even the same thing.



More information about the Python-list mailing list