A python problem about int to long promotion just see the idle session

mensanator at aol.com mensanator at aol.com
Wed May 3 20:30:13 CEST 2006


gen_tricomi wrote:
> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
> on win32
> Type "copyright", "credits" or "license()" for more information.
>
>     ****************************************************************
>     Personal firewall software may warn about the connection IDLE
>     makes to its subprocess using this computer's internal loopback
>     interface.  This connection is not visible on any external
>     interface and no data is sent to or received from the Internet.
>     ****************************************************************
>
> IDLE 1.1.2
> >>> import sys
> >>> save_maxint = sys.maxint
> >>> save_maxint
> 2147483647
> >>> save_maxint += 1
> >>> save_maxint
> 2147483648L
> >>> save_maxint - 1
> 2147483647L
> >>> save_maxint + 1
> 2147483649L
> >>> save_maxint - 1
> 2147483647L
> >>> save_maxint + 1
> 2147483649L
> >>> save_maxint - 1
> 2147483647L
> >>> save_maxint + 1
> 2147483649L
>
>
> from the above you can see what int to long promotion is causing

Nope, it's not the promotion causing the problem.

> i dont need to say much please see for yourself. is this a bug or
> a feature.

Neither. Try changing the "+" and "-" to "+=" and "-=".

>
> please mail me if you can help

"I don't think there can be any question about it.
It can only be attributable to human error.
This sort of thing has cropped up before...
...and it has always been due...
...to human error."
- HAL, 2001: A Space Odessy


> 
> ogahejini at yahoo.com




More information about the Python-list mailing list