-
Bastien Montagne authored
Raising StopIteration was never a good idea to abort a generator function, and since 3.6 it's converted to a regular RuntimeError exception! Proper way to do that is just to use return statement (as long as there is a yield statement somewhere in the function code, it is a generator, and return statement has proper special handling in that case).
Bastien Montagne authoredRaising StopIteration was never a good idea to abort a generator function, and since 3.6 it's converted to a regular RuntimeError exception! Proper way to do that is just to use return statement (as long as there is a yield statement somewhere in the function code, it is a generator, and return statement has proper special handling in that case).