3 ms·
The iterator is consumed in C using any(), instead of the Python bytecode being executed to perform the loop. I don't know if it'd work for "any Python function
by jedsmith 16y ago
The iterator is consumed in C using any(), instead of the Python bytecode being executed to perform the loop. I don't know if it'd work for "any Python function," but I'd definitely look at it for long-running iterators.