On Mon, May 23, 2005, Greg Ewing wrote:
>
> But I also found it interesting that, while the spec requires the
> existence of a context for each operation, it apparently *doesn't*
> mandate that it must be kept in a global variable, which is the part
> that makes me uncomfortable.
>
> Was there any debate about this choice when the Decimal module was
> being designed?

Absolutely.  First of all, as Michael Chermside pointed out, it's
actually thread-local.  But even without that, we were still prepared to
release Decimal with global context.  Look at Java: you have to specify
the context manually with every operation.  It was a critical design
criterion for Python that this be legal::

    >>> x = Decimal('1.2')
    >>> y = Decimal('1.4')
    >>> x*y
    Decimal("1.68")

IOW, constructing Decimal instances might be a bit painful, but *using*
them would be utterly simple.
-- 
Aahz ([EMAIL PROTECTED])           <*>         http://www.pythoncraft.com/

"The only problem with Microsoft is they just have no taste." --Steve Jobs
_______________________________________________
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

Reply via email to