[New-bugs-announce] [issue22900] decimal.Context Emin, Emax limits restrict functionality without adding benefits

Jure Erznožnik report at bugs.python.org
Wed Nov 19 12:51:39 CET 2014


New submission from Jure Erznožnik:

At some point since Python 2.7, the EMin, Emax members got more restrictive bounds. Emin cannot go above 0 and Emax cannot go below 0.

I would argue against this logic:
.prec specifies total precision
.Emin and .Emax effectively limit possible locations of decimal point within the given precision. Since they don't specify / enforce EXACT position of the decimal point, what's the point of limiting them?

Without restrictions, setting Emin = Emax = some positive number effectively restricts number of decimal places to exactly that positive number without a need for separate (and expensive) .quantize() calls.

Removing this restriction provides an option to use decimal as true fixed-point arithmetic.

----------
components: Extension Modules
messages: 231374
nosy: Jure.Erznožnik
priority: normal
severity: normal
status: open
title: decimal.Context Emin, Emax limits restrict functionality without adding benefits
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22900>
_______________________________________


More information about the New-bugs-announce mailing list