diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-19 06:09:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-19 06:09:46 (GMT) |
commit | 2b57c43f21f891df4c6f2294a3b9e1b9029a16b6 (patch) | |
tree | 0a875796fdcf96a15280d181efbf0c5fbb09eba6 /Doc/whatsnew/2.5.rst | |
parent | 82d73554e4764350bfd8f13957c5e024ac95c4af (diff) | |
download | cpython-2b57c43f21f891df4c6f2294a3b9e1b9029a16b6.zip cpython-2b57c43f21f891df4c6f2294a3b9e1b9029a16b6.tar.gz cpython-2b57c43f21f891df4c6f2294a3b9e1b9029a16b6.tar.bz2 |
bpo-35506: Remove redundant and incorrect links from keywords. (GH-11174)
Diffstat (limited to 'Doc/whatsnew/2.5.rst')
-rw-r--r-- | Doc/whatsnew/2.5.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index f803a29..4e85aba 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -370,7 +370,7 @@ PEP 341: Unified try/except/finally Until Python 2.5, the :keyword:`try` statement came in two flavours. You could use a :keyword:`finally` block to ensure that code is always executed, or one or more :keyword:`except` blocks to catch specific exceptions. You couldn't -combine both :keyword:`except` blocks and a :keyword:`finally` block, because +combine both :keyword:`!except` blocks and a :keyword:`!finally` block, because generating the right bytecode for the combined version was complicated and it wasn't clear what the semantics of the combined statement should be. @@ -435,10 +435,10 @@ When you call ``counter(10)``, the result is an iterator that returns the values from 0 up to 9. On encountering the :keyword:`yield` statement, the iterator returns the provided value and suspends the function's execution, preserving the local variables. Execution resumes on the following call to the iterator's -:meth:`next` method, picking up after the :keyword:`yield` statement. +:meth:`next` method, picking up after the :keyword:`!yield` statement. In Python 2.3, :keyword:`yield` was a statement; it didn't return any value. In -2.5, :keyword:`yield` is now an expression, returning a value that can be +2.5, :keyword:`!yield` is now an expression, returning a value that can be assigned to a variable or otherwise operated on:: val = (yield i) @@ -458,7 +458,7 @@ expression on the right-hand side of an assignment. This means you can write Values are sent into a generator by calling its ``send(value)`` method. The generator's code is then resumed and the :keyword:`yield` expression returns the specified *value*. If the regular :meth:`next` method is called, the -:keyword:`yield` returns :const:`None`. +:keyword:`!yield` returns :const:`None`. Here's the previous example, modified to allow changing the value of the internal counter. :: @@ -644,7 +644,7 @@ Writing Context Managers ------------------------ Under the hood, the ':keyword:`with`' statement is fairly complicated. Most -people will only use ':keyword:`with`' in company with existing objects and +people will only use ':keyword:`!with`' in company with existing objects and don't need to know these details, so you can skip the rest of this section if you like. Authors of new objects will need to understand the details of the underlying implementation and should keep reading. @@ -750,9 +750,9 @@ generator function instead of defining a new class. The generator should yield exactly one value. The code up to the :keyword:`yield` will be executed as the :meth:`__enter__` method, and the value yielded will be the method's return value that will get bound to the variable in the ':keyword:`with`' statement's -:keyword:`as` clause, if any. The code after the :keyword:`yield` will be +:keyword:`!as` clause, if any. The code after the :keyword:`yield` will be executed in the :meth:`__exit__` method. Any exception raised in the block will -be raised by the :keyword:`yield` statement. +be raised by the :keyword:`!yield` statement. Our database example from the previous section could be written using this decorator as:: @@ -776,7 +776,7 @@ decorator as:: The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)`` function that combines a number of context managers so you don't need to write nested -':keyword:`with`' statements. In this example, the single ':keyword:`with`' +':keyword:`with`' statements. In this example, the single ':keyword:`!with`' statement both starts a database transaction and acquires a thread lock:: lock = threading.Lock() |