We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac9d37c commit 92c4aa7Copy full SHA for 92c4aa7
1 file changed
Doc/library/stdtypes.rst
@@ -956,6 +956,12 @@ methods.
956
More information about generators can be found in :ref:`the documentation for
957
the yield expression <yieldexpr>`.
958
959
+.. note::
960
+
961
+ Calling ``close()`` on a generator raises a ``GeneratorExit`` exception inside the generator
962
+ at the point where it is paused. If this exception is not caught or handled inside the
963
+ generator (for example, using ``try``/``except`` or ``finally``), then the call to
964
+ ``close()`` will simply return ``None`` without raising any error to the caller.
965
966
.. _typesseq:
967
0 commit comments