18 Oct
2017
18 Oct
'17
10:26 a.m.
On 18 October 2017 at 10:56, Koos Zevenhoven <k7hoven@gmail.com> wrote:
I'm unable to reproduce the "uninterruptible with Ctrl-C" problem with infinite iterators. At least itertools doesn't seem to have it:
import itertools for i in itertools.count(): ... pass ... ^CTraceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt
That's not the issue here, as the CPython interpreter implements this with multiple opcodes, and checks between opcodes for Ctrl-C. The demonstration is:
import itertools 'x' in itertools.count()
... only way to break out is to kill the process. Paul