prePEP: Decimal data type

Tim Peters at
Thu Nov 6 16:51:49 CET 2003

> Well, sure.  And it won't be hard to add given that Decimal will
> already need to track thread-specific Context.  But modules changing
> Context will still need to explicitly push and pop Context because
> usually you will just want to replace the current Context.

They have another choice, because Guido had a brilliant idea:  the
arithmetic operations in Eric's implementation are methods *of* a context
object (because Guido suggested that).  So a maximally robust library
doesn't *have* to change the thread context at all:  it can create whatever
private context object(s) it needs, and spell arithmetic as explicit method
calls on its private context object(s), so that the default thread context
object is neither consulted nor modified.  This is very robust, and in small
doses is quite bearable.

More information about the Python-list mailing list