PyDocs

Nav

Python Runtime Services

generator.close

builtins

method
  • generator.close()
Raises a GeneratorExit exception at the point where the generator function is currently suspended (equivalent to calling throw(GeneratorExit)).
Changed in 3.13
  • 3.13: If a generator returns a value upon being closed, the value is returned by close(). Previously, it returned None.
0 Examples
No examples for builtins/generator.close.
See Also
No see-alsos for builtins/generator.close
0 Notes
No notes for generator.close