Not that it changes your reply, but just for my own sanity:<br>int('7' * 10 ** 6) <- does this not just type-cast a char into an int?<br><br>Meaning that rather then consuming 1024k as you stated, it would consume 2048k at the peak of the calculation(2bytes per char? * 1m = 2048k) then typecasting to int would drop it back down to 1k (1byte per int * 1m = 1024k
<br><br>So, just for sake of getting to a point since I missed the one by the original poster.. why would you not convert that 7 from a char to an int first? That calculation is almost instant, and it doesn't require the memory rollercoaster that this calculation would require..
<br><br>Anyways.. back to the poster... <br><br>Perhaps you wanted an error like this?<br><br>print '=' * 1000000000<br>Traceback (most recent call last):<br> File "<input>", line 1, in ?<br>MemoryError<br>
<br><br><div><span class="gmail_quote">On 11/17/06, <b class="gmail_sendername">Luke Paireepinart</b> <<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Chris Hengge wrote:<br>> I'm thinking you either have a problem with a memory leak (my memory<br>> isn't changing, just at 100% CPU), or your CPU overheated from poor<br>> cooling since it is at 100% utilization.
<br>yeah I second this...<br>there's no reason why this would reboot your computer.<br>At Chris: It's building a string that's 1,000,000 characters long, so it<br>should be increasing your memory usage by at least 1,000,000 characters,
<br>or 1 mb. But that's over a probably long period of time, so you just<br>didn't notice any change.<br>><br>> On 11/17/06, *Chris Hengge* <<a href="mailto:pyro9219@gmail.com">pyro9219@gmail.com</a><br>> <mailto:
<a href="mailto:pyro9219@gmail.com">pyro9219@gmail.com</a>>> wrote:<br>><br>> Well, I dont get the point.. its not locking up my system or<br>> anything.. its just crunching away... even while I type this...
<br>> I guess your point is that it should stop since a 32 bit O/S can<br>> only count to:<br>> 4,294,967,296<br>><br>> On 11/17/06, *Thomas* < <a href="mailto:tavspam@gmail.com">tavspam@gmail.com
</a><br>> <mailto:<a href="mailto:tavspam@gmail.com">tavspam@gmail.com</a>>> wrote:<br>><br>> Earlier today I typed the following into my pythonwin<br>> interactive interpreter in windows xp:
<br>><br>> >>> int('7' * 10 ** 6)<br>><br>> I expected either an error message or it to get stuck and<br>> require me to stop the process manually.<br>><br>> I read that unlike long integers in C, longs in python are
<br>> only limited by the amount of memory (and virtual memory) your<br>> system has.<br>><br>> Can you guess what it did?<br>><br>> I'm temped to end the post here, but I'm new to this list and
<br>> its possible that people might be annoyed by me not getting to<br>> the point within my initial post, so here's what it did:<br>><br>> It thought about it for about 2 seconds then restarted my pc!
<br>> explanations welcome.<br>><br><br></blockquote></div><br>