[Python-ideas] Membership of infinite iterators

Koos Zevenhoven k7hoven at gmail.com
Wed Oct 18 17:37:03 EDT 2017

On Wed, Oct 18, 2017 at 10:30 PM, Serhiy Storchaka <storchaka at gmail.com>

> 18.10.17 22:21, Koos Zevenhoven пише:
>> ​Nice! Though I'd really like a general ​solution that other code can
>> easily adopt, even third-party extension libraries.
> What is the more general solution? For interrupting C code you need to
> check signals manually, either in every loop, or in every iterator. It
> seems to me that the number of loops is larger than the number of iterators.
​Sorry, I missed this email earlier.

Maybe a macro like Py_MAKE_THIS_LOOP_BREAKABLE_FOR_ME_PLEASE that you could
insert wherever you think the code might be spending some time without
calling any Python code. One could use it rather carelessly, at least more
so than refcounts. Something like the macro you wrote, except that it would
take care of the whole thing and not just the counting.

-- Koos

+ Koos Zevenhoven + http://twitter.com/k7hoven +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171019/13762e8c/attachment.html>

More information about the Python-ideas mailing list