On 1/20/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Jason Orendorff wrote: > > DecimalContext has a few problems. In code where it matters, every > > function you write has to worry about it. (That is, you can't just > > write __decimal_context__ = ... at the top of the file and be done > > with it, the way you can with, say, __metaclass__.) > > No, you write "decimal.setcontext(...)" instead.
You seem to be implying these are roughly equal in convenience; I disagree. Suppose I have banking.py, in which it's important to use a particular precision and rounding. Now I have to put context-munging code in every single function that banking.py exposes. And around every 'yield'. Even with 'with', that's a lot of extra lines of code. I'd much prefer to put a one-liner at the top of the file, if it were possible (...but I don't see how, yet). Again, none of this is likely to matter--unless you're interleaving banking and heavy scientific calculations, which I try to avoid. So, not a big deal. Thanks for the response. > > And > > DecimalContext doesn't fit in with generators. > > It does fit actually - you simply have to remember to restore the original > context around any invocations of yield. Feh! "Fit" is to "can be made to work with a bit of effort, just don't forget to follow the rules" as Python is to C++. -j _______________________________________________ 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