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/2006-August/068533.html below:

[Python-Dev] Py2.5 issue: decimal context manager misimplemented, misdesigned, and misdocumented

[Python-Dev] Py2.5 issue: decimal context manager misimplemented, misdesigned, and misdocumentedPhillip J. Eby pje at telecommunity.com
Wed Aug 30 02:40:00 CEST 2006
At 05:20 PM 8/29/2006 -0700, Raymond Hettinger wrote:
>* The implementation's doc string examples were not tested and don't
>work (this is a deep error).  One reads:
>
>     with decimal.getcontext() as ctx:
>         ctx.prec += 2
>         s = ...
>     return +s
>
>
>To get this to work with the current implementation, it should read
>
>     with decimal.getcontext().copy().get_manager() as ctx:
>         ctx.prec += 2
>         s = ...
>     return +s
>
>This is horrid.  Please either revert the patch or fix it to match PEP-343.

Actually, as I read the code, that would be:

     with decimal.getcontext().get_manager() as ctx:

Which is still horrible, but unfortunately Guido has already pronounced 
that __context__ must be removed from PEP 343, which is what caused this 
abomination to come about.

The PEP currently offers the idea of a 'localcontext()' API that provides a 
nicer spelling, but it appears nobody implemented it.

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