
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2010-12-08 13:56 byskrah, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue10650.diff | skrah,2012-08-25 15:15 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg123603 -(view) | Author: Stefan Krah (skrah)*![]() | Date: 2010-12-08 13:56 | |
I'm not sure if this is a documentation issue or a bug. If watchexp=0,quantize() also allows any number of digits:>>> x = Decimal("6885998238912213556789006667970467609814")>>> y = Decimal("1e2")>>> x.quantize(y)Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.2/decimal.py", line 2488, in quantize 'quantize result has too many digits for current context') File "/usr/local/lib/python3.2/decimal.py", line 3925, in _raise_error raise error(explanation)decimal.InvalidOperation: quantize result has too many digits for current context>>> >>> x.quantize(y, watchexp=0)Decimal('6.8859982389122135567890066679704676098E+39') | |||
| msg123607 -(view) | Author: Stefan Krah (skrah)*![]() | Date: 2010-12-08 14:36 | |
NaNs, however, are decapitated:>>> x = Decimal("NaN5357671565858315212612021522416387828577")>>> y = 0>>> x.quantize(y, watchexp=0)Decimal('NaN8315212612021522416387828577') | |||
| msg164429 -(view) | Author: Stefan Krah (skrah)*![]() | Date: 2012-06-30 21:56 | |
Ping. We have to decide if we need watchexp in _decimal. I've left itout so far since all I can gather from the docs is that it somehowbehaves like _rescale.Can we deprecate it and replace it by a proper rescale? | |||
| msg164430 -(view) | Author: Mark Dickinson (mark.dickinson)*![]() | Date: 2012-06-30 22:03 | |
I'd be happy to see watchexp deprecated. It feels like a leftover implementation artefact; its behaviour isn't properly defined anywhere, and as far as I can tell it has only a single testcase. | |||
| msg164439 -(view) | Author: Raymond Hettinger (rhettinger)*![]() | Date: 2012-07-01 00:40 | |
Does anyone know why watchexp was put there in the first place?http://speleotrove.com/decimal/daops.html#refquantIf no motivation for this can be found, I agree with Mark that it should be deprecated and removed. | |||
| msg164467 -(view) | Author: Stefan Krah (skrah)*![]() | Date: 2012-07-01 09:42 | |
watchexp was available in rescale() from the beginning ...http://svn.python.org/view/sandbox/trunk/decimal/Decimal.py?revision=40721&view=markup... and rescale() was renamed to quantize() inhttp://svn.python.org/view/sandbox/trunk/decimal/Decimal.py?revision=40909&view=markuprescale() was once part of the specification, but had identical semantics toquantize(), which is not specified to allow unlimited rescaling.I suppose the original rescale() in the sandbox had watchexp for convenience,in order to avoid two separate functions.watchexp made it into quantize(), probably because people thought there isa need for unlimited rescaling. This may be true, but I'd really prefer toexpose rescale() as the unlimited version then.While it's unusual to just drop an API without deprecation, I think it's OKin this instance: Virtually all decimal code I saw needs to be cleaned upanyway because it uses tons of underscore methods from decimal.py.The only thing that worries me is that there might be code which *really*needs unlimited rescaling. Such code could of course also use a temporarycontext.So I propose this: Deprecate watchexp and leave it in the Python version forone release. The C version won't have watchexp from the start. After all,PEP-399 allows accelerator modules to implement a subset of the functionalityof the Python version -- sometimes PEPs are a wonderful thing :). | |||
| msg169141 -(view) | Author: Stefan Krah (skrah)*![]() | Date: 2012-08-25 15:14 | |
Here's a patch deprecating watchexp. | |||
| msg169448 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2012-08-30 10:39 | |
New changeset7db16ff9f5fd by Stefan Krah in branch 'default':Closes#10650: Deprecate the watchexp parameter of Decimal.quantize().http://hg.python.org/cpython/rev/7db16ff9f5fd | |||
| msg170085 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2012-09-09 09:18 | |
New changesete4ca4edee8bd by Stefan Krah in branch 'default':Closes#10650: Deprecate the watchexp parameter of Decimal.quantize().http://hg.python.org/cpython/rev/e4ca4edee8bd | |||
| msg217631 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-04-30 17:16 | |
New changesetc2f827af02a2 by Stefan Krah in branch 'default':Issue#10650: Remove the non-standard 'watchexp' parameter from thehttp://hg.python.org/cpython/rev/c2f827af02a2 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:09 | admin | set | github: 54859 |
| 2014-04-30 17:16:20 | python-dev | set | messages: +msg217631 |
| 2012-09-09 09:18:53 | python-dev | set | messages: +msg170085 |
| 2012-08-30 10:39:41 | python-dev | set | status: open -> closed nosy: +python-dev messages: +msg169448 resolution: fixed stage: resolved |
| 2012-08-25 15:15:34 | skrah | set | files: +issue10650.diff keywords: +patch |
| 2012-08-25 15:14:56 | skrah | set | messages: +msg169141 |
| 2012-07-01 09:42:29 | skrah | set | messages: +msg164467 |
| 2012-07-01 00:40:48 | rhettinger | set | messages: +msg164439 |
| 2012-06-30 22:03:04 | mark.dickinson | set | messages: +msg164430 |
| 2012-06-30 21:56:08 | skrah | set | nosy: +georg.brandl messages: +msg164429 |
| 2010-12-08 14:36:13 | skrah | set | messages: +msg123607 |
| 2010-12-08 13:56:10 | skrah | create | |