Commit f1f42d85 authored by Nick Coghlan's avatar Nick Coghlan

Fix final documentation nits before backporting decimal module fixes to 2.5

parent c1120b4b
...@@ -453,12 +453,12 @@ active context. ...@@ -453,12 +453,12 @@ active context.
no context is specified, a copy of the current context is used. no context is specified, a copy of the current context is used.
\versionadded{2.5} \versionadded{2.5}
For example, the following code increases the current decimal precision For example, the following code set the current decimal precision
by 42 places, performs a calculation, and then automatically restores to 42 places, performs a calculation, and then automatically restores
the previous context: the previous context:
\begin{verbatim} \begin{verbatim}
from __future__ import with_statement from __future__ import with_statement
import decimal from decimal import localcontext
with localcontext() as ctx: with localcontext() as ctx:
ctx.prec = 42 # Perform a high precision calculation ctx.prec = 42 # Perform a high precision calculation
......
...@@ -683,9 +683,10 @@ with lock: ...@@ -683,9 +683,10 @@ with lock:
The lock is acquired before the block is executed and always released once The lock is acquired before the block is executed and always released once
the block is complete. the block is complete.
The \module{decimal} module's contexts, which encapsulate the desired The new \function{localcontext()} function in the \module{decimal} module
precision and rounding characteristics for computations, provide a makes it easy to save and restore the current decimal context, which
\function{localcontext()} function for getting a context manager: encapsulates the desired precision and rounding characteristics for
computations:
\begin{verbatim} \begin{verbatim}
from decimal import Decimal, Context, localcontext from decimal import Decimal, Context, localcontext
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment