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
3c1983fa
Commit
3c1983fa
authored
Apr 30, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1479438: add \keyword markup for "with".
parent
3583cff5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
Doc/ref/ref3.tex
Doc/ref/ref3.tex
+3
-3
Doc/ref/ref7.tex
Doc/ref/ref7.tex
+2
-2
No files found.
Doc/ref/ref3.tex
View file @
3c1983fa
...
...
@@ -2149,9 +2149,9 @@ using a generator function decorated with the
than writing individual
\method
{__
enter
__
()
}
and
\method
{__
exit
__
()
}
methods on a separate object when the state to be managed is complex.
With statement context objects also need to implement this method; they
are required to return themselves (that is, this method will simply
return
\var
{
self
}
).
\keyword
{
with
}
statement context objects also need to implement this
method; they are required to return themselves (that is, this method
will simply
return
\var
{
self
}
).
\end{methoddesc}
\begin{methoddesc}
[with statement context]
{__
enter
__}{
self
}
...
...
Doc/ref/ref7.tex
View file @
3c1983fa
...
...
@@ -315,7 +315,7 @@ statement to generate exceptions may be found in section~\ref{raise}.
\versionadded
{
2.5
}
The
\keyword
{
with
}
statement is used to wrap the execution of a block
with methods defined by a context manager or
with
statement context
with methods defined by a context manager or
\keyword
{
with
}
statement context
object (see section~
\ref
{
context-managers
}
). This allows common
\keyword
{
try
}
...
\keyword
{
except
}
...
\keyword
{
finally
}
usage patterns to
be encapsulated for convenient reuse.
...
...
@@ -332,7 +332,7 @@ The execution of the \keyword{with} statement proceeds as follows:
\item
The context expression is evaluated, to obtain a context manager.
\item
The context manger's
\method
{__
context
__
()
}
method is
invoked to obtain a
with
statement context object.
invoked to obtain a
\keyword
{
with
}
statement context object.
\item
The context object's
\method
{__
enter
__
()
}
method is invoked.
...
...
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