Integer Overflow

Steve Holden sholden at holdenweb.com
Tue Nov 27 14:03:36 EST 2001


"Ursus Horibilis" <ursus_horibilis at hotmail.com> wrote in ...
>
[...]
>
> At the moment, I'm working with 2.0.  Is it legal to assign a
> (long) to an (int) if the long contains a number that is bigger
> than the (int) can store?
>
Only because you don't "assign a long to an int". You rebind a name formerly
bound to an int to a long. Since all operations on longs will produce
something at least as wide as a long, you will need to force coercion to
integer by calling int() on your longs.

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list