2 ms·
Even the language itself does this: if a generator that is being processed by a for loop returns (rather than yield), the language will raise a StopIteration ex
by icebraining 9y ago
Even the language itself does this: if a generator that is being processed by a for loop returns (rather than yield), the language will raise a StopIteration exception, which the for loop with catch and use as a signal that it should exit.