No ValueError for large exponents?

Duncan Booth duncan.booth at invalid.invalid
Thu Sep 7 04:52:07 EDT 2006


Robin Becker <robin at NOSPAMreportlab.com> 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. 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.



More information about the Python-list mailing list