bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636)

The enter_context is updated with following information: 'The :meth:`__enter__` method 
      returns the ExitStack instance, and performs no additional operations.'

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
vidhya 2022-03-28 00:31:32 -04:00 committed by GitHub
parent 76f14b0463
commit 86384cf83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -502,6 +502,9 @@ Functions and classes provided:
# the with statement, even if attempts to open files later # the with statement, even if attempts to open files later
# in the list raise an exception # in the list raise an exception
The :meth:`__enter__` method returns the :class:`ExitStack` instance, and
performs no additional operations.
Each instance maintains a stack of registered callbacks that are called in Each instance maintains a stack of registered callbacks that are called in
reverse order when the instance is closed (either explicitly or implicitly reverse order when the instance is closed (either explicitly or implicitly
at the end of a :keyword:`with` statement). Note that callbacks are *not* at the end of a :keyword:`with` statement). Note that callbacks are *not*