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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com