mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Add version added info for with statement and context managers
This commit is contained in:
parent
168e99f6db
commit
d03b073e9b
3 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
\declaremodule{standard}{contextlib}
|
\declaremodule{standard}{contextlib}
|
||||||
\modulesynopsis{Utilities for \keyword{with}-statement contexts.}
|
\modulesynopsis{Utilities for \keyword{with}-statement contexts.}
|
||||||
|
|
||||||
|
\versionadded{2.5}
|
||||||
|
|
||||||
This module provides utilities for common tasks involving the
|
This module provides utilities for common tasks involving the
|
||||||
\keyword{with} statement.
|
\keyword{with} statement.
|
||||||
|
|
||||||
|
|
|
@ -2109,6 +2109,8 @@ implement a \method{__coerce__()} method, for use by the built-in
|
||||||
|
|
||||||
\subsection{Context Managers and Contexts\label{context-managers}}
|
\subsection{Context Managers and Contexts\label{context-managers}}
|
||||||
|
|
||||||
|
\versionadded{2.5}
|
||||||
|
|
||||||
A \dfn{context manager} is an object that manages the entry to, and exit
|
A \dfn{context manager} is an object that manages the entry to, and exit
|
||||||
from, a \dfn{context} surrounding a block of code. Context managers are
|
from, a \dfn{context} surrounding a block of code. Context managers are
|
||||||
normally invoked using the \keyword{with} statement (described in
|
normally invoked using the \keyword{with} statement (described in
|
||||||
|
|
|
@ -312,6 +312,8 @@ statement to generate exceptions may be found in section~\ref{raise}.
|
||||||
\section{The \keyword{with} statement\label{with}}
|
\section{The \keyword{with} statement\label{with}}
|
||||||
\stindex{with}
|
\stindex{with}
|
||||||
|
|
||||||
|
\versionadded{2.5}
|
||||||
|
|
||||||
The \keyword{with} statement is used to wrap the execution of a block
|
The \keyword{with} statement is used to wrap the execution of a block
|
||||||
with methods defined by a context manager (see
|
with methods defined by a context manager (see
|
||||||
section~\ref{context-managers}). This allows common
|
section~\ref{context-managers}). This allows common
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue