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

Chris Angelico rosuav at gmail.com
Tue Apr 2 02:16:28 EDT 2013


On Tue, Apr 2, 2013 at 3:45 PM, Tim Roberts <timr at probo.com> wrote:
> morphex <morphex at gmail.com> wrote:
>>
>>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?
>
> There IS a cap.  It's called the "MemoryError" exception.
>
> But, seriously, what would you have it do instead?

And If you want a lower cap than the one you currently have, check out
ulimit/rlimit - you can trigger MemoryError sooner.

ChrisA



More information about the Python-list mailing list