[Python-ideas] Generator unpacking
Guido van Rossum
guido at python.org
Fri Feb 12 11:39:53 EST 2016
On Fri, Feb 12, 2016 at 5:22 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 12 February 2016 at 22:46, Steven D'Aprano <steve at pearwood.info> wrote:
>> I'm surprised that the unpacking can't be interrupted with Ctrl-C. I
>> think that is a bug.
>
> It's a consequence of looping in C over an infinite iterator also
> implemented in C - "sum(itertools.count())" will hang the same way,
> since control never gets back to the eval loop to notice that Ctrl-C
> has been pressed.
We should occasionally check for signals in such loops. We do that in
other places.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list