System reboot running itertools, why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

System reboot running itertools, why?

Hello Sololearners, Have you noticed the behavior of the count() function when called from Python Interactive Console? Running this code on you PIC will lead you 100% usage: from itertools import count count(10) After a couple of minutes your computer (I'm running on MacBookPro, macOS 10.13.2, python 3.6.3) become unresponsive and eventually reboot. I totally understand that running into an infinite loop has unpredictable results, but I really believe something has to be fixed, either on macOS, python interpreter or both... Would you mind trying it, specially on Windows ? Do you have any idea as to, why is this loop so aggressive ?

24th Dec 2017, 3:23 AM
Joel Arriaza
3 Answers
+ 1
No problems here, running on Python 3.6.0, Windows 10, iMac 2012
25th Dec 2017, 1:14 AM
Ben Smylie (he/him)
Ben Smylie (he/him) - avatar
0
What was the output that you got?
25th Dec 2017, 3:34 AM
Joel Arriaza
0
run it once as you have it in the code above and it just exits normally, return code 0. I even put it in an infinite loop and watched the CPU; no signs of issue. Sorry I couldn't help, but happy holidays/Christmas/Saturnalia :)
25th Dec 2017, 11:38 AM
Ben Smylie (he/him)
Ben Smylie (he/him) - avatar