Message 104310 - Python tracker (original) (raw)

Re: ExtendedContext, the comments in decimal.py say:

Pre-made alternate contexts offered by the specification

Don't change these; the user should be able to select these

contexts and be able to reproduce results from other implementations

of the spec.

This doesn't make a lot of sense to me, since (as Stefan says) the choice of precision 9 doesn't seem to come from the specification.

However, the current ExtendedContext is used extensively in doctests and elsewhere; it would be awkward to change it now. I think adding the IEEE formats and encouraging users to use those in place of ExtendedContext might be the best bet.

I'd also still want to make _clamp public in this case, to avoid people wondering why two apparently identical contexts (one with _clamp=1, one with _clamp=0) can lead to different results.