Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a6540908
Commit
a6540908
authored
Dec 12, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant sentence, and fix markup
parent
5260a9bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+4
-7
No files found.
Doc/library/stdtypes.rst
View file @
a6540908
...
...
@@ -2433,12 +2433,9 @@ Context Manager Types
single: protocol; context management
Python's :keyword:`with` statement supports the concept of a runtime context
defined by a context manager. This is implemented using
two separate
methods
defined by a context manager. This is implemented using
a pair of
methods
that allow user-defined classes to define a runtime context that is entered
before the statement body is executed and exited when the statement ends.
The :dfn:`context management protocol` consists of a pair of methods that need
to be provided for a context manager object to define a runtime context:
before the statement body is executed and exited when the statement ends:
.. method:: contextmanager.__enter__()
...
...
@@ -2486,9 +2483,9 @@ decimal arithmetic context. The specific types are not treated specially beyond
their implementation of the context management protocol. See the
:mod:`contextlib` module for some examples.
Python's :term:`generator`\s and the
``contextlib.contextmanager`` :term:`decorator`
Python's :term:`generator`\s and the
:class:`contextlib.contextmanager` decorator
provide a convenient way to implement these protocols. If a generator function is
decorated with the
``contextlib.contextmanager`
` decorator, it will return a
decorated with the
:class:`contextlib.contextmanager
` decorator, it will return a
context manager implementing the necessary :meth:`__enter__` and
:meth:`__exit__` methods, rather than the iterator produced by an undecorated
generator function.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment