Nick Coghlan <ncogh...@gmail.com> added the comment:

As a potential stepping stone towards possible future changes in the default 
behaviour here, what if itertools were to offer an opt-in "check_signals(itr, 
*, iterations=100_000)" helper function that was essentially a more efficient 
version of::

    def check_signals(itr, *iterations=100_000):
        while True:
            next_slice = islice(itr, iterations)
            for count, item in enumerate(next_slice, 1):
                yield item
            if count < iterations:
                raise StopIteration

This would:

1. Provide a straightforward way for folks to explicitly opt-in to periodic 
signal checks
2. Provide a way to check for potential compatibility issues with other 
libraries and components to better assess the risks of switching the default 
behaviour

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31815>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to