PyDocs

Nav

Python Runtime Services

generator.__next__

builtins

method
  • generator.__next__()
Starts the execution of a generator function or resumes it at the yield expression where the function is currently suspended. When a generator function is resumed with a __next__() method, the current yield expression always evaluates to None. The execution then continues to the next yield expression, where the generator is suspended again, and the value of the expression after the yield keyword is returned to __next__()’s caller. If the generator exits without yielding another value, __next__() raises a StopIteration exception, signalling that iteration has completed.
0 Examples
No examples for builtins/generator.__next__.
See Also
No see-alsos for builtins/generator.__next__
0 Notes
No notes for generator.__next__