Newbie: OverflowError: integer addition - Python data types??

Fredrik Lundh effbot at telia.com
Wed Feb 2 12:50:40 EST 2000


e.e.sutton at cummins.com wrote:
> I can't get a Python version of my VBScript Fibonacci series script to
> work.  I get an OverflowError: integer addition error at series 46.
>
> Can Python not handle large numbers?

plain integers can handle what C's long signed integer
can handle on your platform (usually 32 bits, i.e. +-2E9)

long integers have unlimited precision.

(unlike some other languages, python doesn't auto-
magically change the type if an expression overflows).

> Is there a special data type I should be using?

long integers?

http://www.python.org/doc/current/lib/typesnumeric.html

</F>

PS. assigning to the function name is very unpythonish
(doesn't VBScript support recursion? ;-)





More information about the Python-list mailing list