473,670 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
i dont need to say much please see for yourself. is this a bug or
a feature.

please mail me if you can help

og*******@yahoo .com

May 3 '06 #1
4 1679
"gen_tricom i" <og*******@yaho o.com> wrote:
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
i dont need to say much please see for yourself.


?

</F>

May 3 '06 #2
gen_tricomi wrote:
from the above you can see what int to long promotion is causing
i dont need to say much please see for yourself. is this a bug or
a feature.


This is expected behavior. Why is it problematic for you?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

May 3 '06 #3

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


og*******@yahoo .com


May 3 '06 #4
wow i think i was just been too paranoid.
i thought it would affect some precision arithmetic in science.
thanks for the reply

May 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6011
by: Will Seay | last post by:
At the end of this message I've pasted a script we're trying to modify slightly. I don't believe it is VBscript or javascript but these are the closest groups I could find with my limited programming knowledge. Basically, we are trying to add a few lines to this script that will execute a few shell commands (see comments at the very end of the code). We think this may be ActionScript2 but aren't sure. If you can offer any help, or know...
6
2239
by: Aubrey Hutchison | last post by:
Using Python 2,3,2 with idle for developing programs about 200 lines long. - Problem is not common to any specific program. Program are rather simple with no trick programming. Usually no classes but a few functions using math module with long integers. Usually for the first few tryout everything works fine and then idle locks "out" windows xp pro.. I can run other programs, but clicking on idle icon gets me an hour glass for a few...
145
6293
by: David MacQuigg | last post by:
Playing with Prothon today, I am fascinated by the idea of eliminating classes in Python. I'm trying to figure out what fundamental benefit there is to having classes. Is all this complexity unecessary? Here is an example of a Python class with all three types of methods (instance, static, and class methods). # Example from Ch.23, p.381-2 of Learning Python, 2nd ed. class Multi:
15
7377
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a history command in IDLE (in fact with IDLE in general). Often I'll develop new code at the command line, testing each line as I go. Currently I have to copy and paste, removing outputs and the ">>>" at each line. Is it perhaps possible to make...
0
1977
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open ( +4) / 291 closed ( +4) / 553 total ( +8) New / Reopened Patches ______________________
0
948
by: Jeff Rush | last post by:
With the recent establishment of the wiki page on python.org for those who offer training services for the Python language, we now have 23 listed, worldwide. http://wiki.python.org/moin/PythonTraining Many of the trainers are individuals or small companies, and it can be hard to get the attention of the big IT houses. While skill credentials and a portfolio of past training gigs are important, perhaps one of the best promoters is when...
12
1736
by: WaterWalk | last post by:
Hello. I wonder what's the effective way of figuring out how a piece of python code works. With C I often find it very useful to be able to run the code in step mode and set breakpoints in a debugger so I can watch how the it executes, how the data change and how the code jumps from one function to another. But with Python, the debugger is a little primitive. The default IDLE doesn't even allow me to set a breakpoint. When the code is...
0
8468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8660
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4209
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2041
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.