473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

No ValueError for large exponents?

As many have heard, IronPython 1.0 was released. When I was looking
through the listed differences between CPython and IronPython, the
document mentioned that using large exponents such as 10 **
735293857239475 will cause CPython to hang, whereas IronPython will
raise a ValueError. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?

Sep 6 '06 #1
4 1821
enigmadude wrote:
As many have heard, IronPython 1.0 was released. When I was looking
through the listed differences between CPython and IronPython, the
document mentioned that using large exponents such as 10 **
735293857239475 will cause CPython to hang, whereas IronPython will
raise a ValueError. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?
I suspect the hang may be python actually trying to work out the
1 followed by 735293857239475 zeroes. Perhaps IronPython has a forward
looking algorithm that knows when to give up early.
--
Robin Becker
Sep 6 '06 #2
Robin Becker <ro***@NOSPAMreportlab.comwrote:
enigmadude wrote:
>As many have heard, IronPython 1.0 was released. When I was looking
through the listed differences between CPython and IronPython, the
document mentioned that using large exponents such as 10 **
735293857239475 will cause CPython to hang, whereas IronPython will
raise a ValueError. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?
I suspect the hang may be python actually trying to work out the
1 followed by 735293857239475 zeroes. Perhaps IronPython has a forward
looking algorithm that knows when to give up early.
My guess would be that IronPython preallocates sufficient memory for the
resulting string, so will fail immediately, and CPython must be trying to
grow the string dynamically.
Sep 7 '06 #3
enigmadude wrote:
As many have heard, IronPython 1.0 was released. When I was looking
through the listed differences between CPython and IronPython, the
document mentioned that using large exponents such as 10 **
735293857239475 will cause CPython to hang, whereas IronPython will
raise a ValueError.
What message does that value error have?

If it's a memory issue, the operation should raise MemoryError (at
least in CPython).

Georg
Sep 7 '06 #4
Georg Brandl wrote:
enigmadude wrote:
As many have heard, IronPython 1.0 was released. When I was looking
through the listed differences between CPython and IronPython, the
document mentioned that using large exponents such as 10 **
735293857239475 will cause CPython to hang, whereas IronPython will
raise a ValueError.

What message does that value error have?

If it's a memory issue, the operation should raise MemoryError (at
least in CPython).

Georg
I haven't run IronPython yet, but the "Differences" document says that
IronPython would raise a ValueError. It wasn't any more specific than
that. As far as CPython, I didn't wait long enough for it to raise a
MemoryError if it was going to raise one at all. From a user point of
view, CPython appeared to hang for about one minute, slowly raising CPU
usage and RAM usage, before I finally decided to just kill the process.
I don't know whether or not it would have completed 5 minutes later or
whether it would hang indefinitely, I haven't tested it. Although I may
be overreacting, I would wonder about the ramifications of something
like this hanging the interpreter (possible vector for DOS attack on an
webapp server, or even the machine itself if it balloons RAM usage?).
I'm not trying to be a doomsayer or anything, but I just want to know
how CPython handles extreme cases like this.

Sep 10 '06 #5

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

Similar topics

12
by: Aki Niimura | last post by:
Hello everyone, I started to use pickle to store the latest user settings for the tool I wrote. It writes out a pickled text file when it terminates and it restores the settings when it starts....
1
by: Tom McCallum | last post by:
Is there any way to override the normal output of doubles? I am outputting numbers around 5 million and would like them to be formatted normally (5000000) instead of with exponents (5e06). What...
2
by: Alex Vinokur | last post by:
Does STL contain algorithms which generate (enable to generate) exponents, permutations, arrangements, and combinations for any numbers and words? -- Alex Vinokur mailto:alexvn@connect.to...
5
by: Todd Steury | last post by:
Greetings Python'ers: I'm just an amature who occasionally uses Python for complex mathematical models. The current model I'm working with occasionally generates really large numbers that are...
16
by: raj | last post by:
Hi, I saw it mentioned that "int" is the fastest data-type for use in C ,that is data storage/retrieval would be the fastest if I use int among the following 4 situations in a 32 bit machine with...
2
by: Stefan L | last post by:
Hi NG, I have the following problem: Is there a way to use exponents in C#-code without converting to a double and then use System.Math? I have to convert VB-Code to C# and in VB its easy...
0
by: Chris Fonnesbeck | last post by:
I have built the following unit test, observing the examples laid out in the python docs: class testMCMC(unittest.TestCase): def setUp(self): # Create an instance of the sampler...
1
by: alain MONTMORY | last post by:
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem..... :-http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding I download the...
12
by: zalery | last post by:
so i'm trying to set up this exponents loop, keep in mind this is my first year in computer science so my knowledge of script is somewhat minimal. basically this assignment (or at least part of it)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.