[Python-ideas] Membership of infinite iterators

Paul Moore p.f.moore at gmail.com
Wed Oct 18 11:36:39 EDT 2017


On 18 October 2017 at 16:27, Koos Zevenhoven <k7hoven at gmail.com> wrote:
> So you're talking about code that would make a C-implemented Python iterable
> of strictly C-implemented Python objects and then pass this to something
> C-implemented like list(..) or sum(..), while expecting no Python code to be
> run or signals to be checked anywhere while doing it. I'm not really
> convinced that such code exists. But if such code does exist, it sounds like
> the code is heavily dependent on implementation details.

Well, the OP specifically noted that he had recently encountered
precisely that situation:

"""
I recently came across a bug where checking negative membership
(__contains__ returns False) of an infinite iterator will freeze the
program.
"""

Paul


More information about the Python-ideas mailing list