pyphi.parallel.shortcircuit#

pyphi.parallel.shortcircuit(items, shortcircuit_func=<function false>, shortcircuit_callback=None, shortcircuit_callback_args=None)[source]#

Yield items, stopping after the first for which a predicate holds.

Each item is yielded first, then shortcircuit_func is tested on it. When the predicate is true, shortcircuit_callback (if given) is called with shortcircuit_callback_args — defaulting to the list of items yielded so far, ending with the triggering item — and iteration stops.

Parameters: