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 (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "The only problem with Microsoft is they just have no taste." --Steve Jobs
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4