System reboot running itertools, why? | Sololearn: Learn to code for FREE!


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 ?

12/24/2017 3:23:37 AM

Joel Arriaza

3 Answers

New Answer


No problems here, running on Python 3.6.0, Windows 10, iMac 2012


What was the output that you got?


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 :)