On Thu, Jan 31, 2013 at 12:53 PM, Larry Hastings email@example.com wrote:
But if the user assigns a different value to math.__dict__['pi'], math.pi will diverge, which again could break code. (Who might try to assign a different value to pi? The 1897 House Of Representatives of Indiana for one!)
More generally, it's often useful to monkeypatch "constants" at runtime, for testing purposes (and for less justifiable purposes). Why prevent that? I cite the Consenting Adults rule.
I've never actually been in the situation of doing it, but wouldn't it be reasonable to switch out math.pi to be (say) a decimal.Decimal rather than a float?