On Wed, Oct 18, 2017 at 2:38 PM, Steven D'Aprano <steve@pearwood.info> wrote:
On Wed, Oct 18, 2017 at 01:39:28PM +0300, Koos Zevenhoven wrote:

> I'm writing from my phone now, cause I was dumb enough to try list(count())

You have my sympathies -- I once, due to typo, accidentally ran
something like range(10**100) in Python 2.


​Oh, I think I've done something like that too, and there are definitely still opportunities in Python 3 to ask for the impossible. But what I did now, I did "on purpose".​ For a split second, I really wanted to know how bad it would be. But a few minutes later I had little interest left in that ;). Rebooting a computer definitely takes longer than restarting a Python process.
 

> But should it be fixed in list or in count?

Neither. There are too many other places this can break for it to be
effective to try to fix each one in place.


​To clarify, I was talking about allowing Ctrl-C to break it, which somebody had suggested. That would also help if the C-implemented iterable just takes a lot of time to generate the items.

​And for the record, I just tried

>>> sum(itertools.count())

And as we could expect, it does not respect Ctrl-C either. 


––Koos



--
+ Koos Zevenhoven + http://twitter.com/k7hoven +