On Wed, 29 Nov 2017 09:39:57 +0200
Serhiy Storchaka
wrote:
> 29.11.17 03:34, Steven D'Aprano пише:
> > This wastes the opportunity to fail fast on operations which cannot
> > possibly succeed, e.g. list(count()) must eventually fail with
> > MemoryError. Or worse: if the OS starts thrashing trying
29.11.17 03:34, Steven D'Aprano пише:
This wastes the opportunity to fail fast on operations which cannot
possibly succeed, e.g. list(count()) must eventually fail with
MemoryError. Or worse: if the OS starts thrashing trying to meet the
memory requests, you can lock up the computer.
I propose t
PEP 424 allows iterators to optionally offer a hint as to how long they
will be:
https://www.python.org/dev/peps/pep-0424/
Unfortunately, there's no good way for an iterator to report that it is
infinitely long. Consequently, even those which are known to be infinite
report finite lengths:
p