[Tutor] big numbers

Robert Storey y2kbug at ms25.hinet.net
Tue Mar 15 08:06:06 CET 2005


Dear all,

I'm new to Python, and using Sam's Teach Yourself Python in 24 Hours.
The book introduces big numbers, saying that I should expect the
following problem:

>>> 1 + 999999999999999999
OverflowError: integer literal too large

The "problem" is that this doesn't happen. When I execute this command,
Python seems to automatically convert the result into a big number:

>>> 1 + 999999999999999999
1000000000000000000L

This book is a few years old and was written for Python version 1.5, and
of course I'm using version 2.3, so I'm just wondering if this whole
issue of big numbers is now being handled automatically?

This is my first post - sorry to be asking such a basic question.

TIA,
Robert


More information about the Tutor mailing list