prePEP: Decimal data type

Tim Peters tim.one at comcast.net
Thu Nov 6 10:51:49 EST 2003


[Aahz]
> 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