Why does 1**2**3**4**5 raise a MemoryError?

Roy Smith roy at panix.com
Sun Mar 31 09:04:44 EDT 2013


In article <8276eff6-9e5c-4060-b9e8-94fab606206f at googlegroups.com>,
 morphex <morphex at gmail.com> wrote:

> Aha, OK.  Thought I found a bug but yeah that makes sense ;)
> 
> While we're on the subject, wouldn't it be nice to have some cap there so 
> that it isn't possible to more or less block the system with large 
> exponentiation?

Every time we think we know a good upper bound to something (i.e. 
"nobody will ever need more than 64k of memory"), it turns out that 
limit is wrong.

There's great value in writing code which continues to work until it 
runs out of some external resource (i.e. memory, disk space, whatever).  
Eventually, somebody will want to do some calculation which you 
previously thought was absurd but turns out to be useful.

I don't use Python bugnums very often, but when I do, I'm really happy 
they're there.



More information about the Python-list mailing list