[Tutor] big numbers

Ewald Ertl ewald.ertl at hartter.com
Tue Mar 15 09:53:46 CET 2005


Hi!

As far as I can remember, there was a change between some version's of python of 2.x.
Now there is an automatic conversion from int to long, when it is necessary. 

Regards, Ewald

on Tue, 15 Mar 2005 15:06:06 +0800  Robert Storey <y2kbug at ms25.hinet.net> wrote :
---------------------------------------------------------------------------------------------

Robert Storey > Dear all,
Robert Storey > 
Robert Storey > I'm new to Python, and using Sam's Teach Yourself Python in 24 Hours.
Robert Storey > The book introduces big numbers, saying that I should expect the
Robert Storey > following problem:
Robert Storey > 
Robert Storey > >>> 1 + 999999999999999999
Robert Storey > OverflowError: integer literal too large
Robert Storey > 
Robert Storey > The "problem" is that this doesn't happen. When I execute this command,
Robert Storey > Python seems to automatically convert the result into a big number:
Robert Storey > 
Robert Storey > >>> 1 + 999999999999999999
Robert Storey > 1000000000000000000L
Robert Storey > 
Robert Storey > This book is a few years old and was written for Python version 1.5, and
Robert Storey > of course I'm using version 2.3, so I'm just wondering if this whole
Robert Storey > issue of big numbers is now being handled automatically?
Robert Storey > 
Robert Storey > This is my first post - sorry to be asking such a basic question.
Robert Storey > 
Robert Storey > TIA,
Robert Storey > Robert
Robert Storey > _______________________________________________
Robert Storey > Tutor maillist  -  Tutor at python.org
Robert Storey > http://mail.python.org/mailman/listinfo/tutor
Robert Storey > 


------------------- end ----------------------


-- 
Ing. Ewald Ertl         HartterGruppe                   Phone : +43-3352-33085-558
trinomic Projektmanagement & Informationstechnik GmbH   Fax   : +43-3352-33085-600
Wiener Straße 41                                        mailto:ewald.ertl at trinomic.com
A-7400 Oberwart         http://www.trinomic.com         mailto:ewald.ertl at hartter.com



More information about the Tutor mailing list