A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-May/053871.html below:

[Python-Dev] Example for PEP 343

[Python-Dev] Example for PEP 343 [Python-Dev] Example for PEP 343Raymond Hettinger python at rcn.com
Wed May 18 05:03:38 CEST 2005
> I don't see a call to setcontext() in the sin() example in the library
> reference. Is that document wrong? I thought that simply modifying the
> parameters of the current context would be sufficient.

The sin() example is correct.  The precision is changed and restored in
the current context.

However, for a general purpose wrapper, it is preferable to make a
context copy and then restore the context after the enclosed is run.
That guards against the enclosed block making any unexpected context
changes.

Also, since the wrapper is intended to work like a try/finally, it will
make sure the context gets restored even if an exception is raised at
some unexpected point in the middle of the computation.



Raymond 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4