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.
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