[issue25928] Add Decimal.as_integer_ratio()

2016-04-05 Thread Stefan Krah
Stefan Krah added the comment: Raymond, you added your support in msg257097. I'm not very happy to spend my time implementing the feature and then rehashing everything after 3 months. -- nosy: +gvanrossum ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2016-04-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think a new public method should have been added. Historically, we've been careful to not grow the API beyond what is in the spec or the dunder methods required to interface with standard Python. The feature creep is at odds with the intended goals

[issue25928] Add Decimal.as_integer_ratio()

2015-12-29 Thread Stefan Krah
Stefan Krah added the comment: I've opened #25974 for the statistics.py issues. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset f3b09c269af0 by Stefan Krah in branch 'default': Issue #25928: Add Decimal.as_integer_ratio(). Python parts and docs by https://hg.python.org/cpython/rev/f3b09c269af0 -- nosy: +python-dev ___ Python

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Stefan Krah
Stefan Krah added the comment: Hopefully I wasn't moving too fast, but I won't have time in the next days/weeks. Serhiy and Alexander (#8947) would prefer more homogeneous error messages and docstrings between float/pydecimal/cdecimal. I wouldn't mind a patch in another issue (no argument

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Stefan Krah
Stefan Krah added the comment: Here's a patch. The Python and doc parts are from Mark (#8947). I did not optimize the normalization yet, in C the code is less clean and there were some corner cases where the gcd is actually faster. -- keywords: +patch Added file:

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: test needed -> patch review ___ Python tracker ___

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 510ff609cb4f by Stefan Krah in branch 'default': Issue #25928: Temporarily disable some tests in test_statistics in order https://hg.python.org/cpython/rev/510ff609cb4f -- ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Hopefully I wasn't moving too fast, but I won't have time in the next days/weeks. No, the patch is pretty clear. Thanks. > Serhiy and Alexander (#8947) would prefer more homogeneous error messages and docstrings between float/pydecimal/cdecimal. This

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Stefan Krah
Stefan Krah added the comment: Steven, could you have a look at the failures in test_statistics? Some tests fail because they assume non-normalized fractions, I still have to look at the other assumptions. -- ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2015-12-28 Thread Stefan Krah
Stefan Krah added the comment: Ah yes, the test_statistics failures look like #18841 again. -- ___ Python tracker ___

[issue25928] Add Decimal.as_integer_ratio()

2015-12-27 Thread Stefan Krah
Stefan Krah added the comment: Previously the method was rejected in #8947. But the speedup is quite dramatic. This is a benchmark for converting "1.91918261298362195e-100", 100 repetitions: float.as_integer_ratio: 0.548023 Decimal.as_integer_ratio: normalize=False: 2.661191

[issue25928] Add Decimal.as_integer_ratio()

2015-12-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Now that there is more than one use case for Decimal.as_integer_ratio(), I'll add my support to this feature request. -- ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2015-12-27 Thread Mark Dickinson
Mark Dickinson added the comment: > Mark, was there perhaps a reason not to add the method? In the past, there's been a desire to keep the decimal module minimal in scope, implementing little more than what's required for the specification. A number of proposed additions have been rejected on

[issue25928] Add Decimal.as_integer_ratio()

2015-12-27 Thread Stefan Krah
Stefan Krah added the comment: Keeping the API small is a good reason against it. There aren't many ways to destructure a Decimal though: As far as I know, the return value of as_tuple() dates back from the time when the coefficient was actually a tuple. The function is slow and not really

[issue25928] Add Decimal.as_integer_ratio()

2015-12-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Arguments against as_integer_ratio() look weighty. But may be there are less arguments against numerator and denominator? -- ___ Python tracker

[issue25928] Add Decimal.as_integer_ratio()

2015-12-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: A visible new feature is an enhancement (even if performance is the reason for the new feature) and can only go in 3.6. -- nosy: +terry.reedy stage: -> test needed type: performance -> enhancement versions: +Python 3.6 -Python 3.5

[issue25928] Add Decimal.as_integer_ratio()

2015-12-23 Thread Stefan Krah
Stefan Krah added the comment: Let's re-target this issue: Implementing as_integer_ratio() sounds reasonable, but let's hope people won't try to convert Decimal('1E+99'). Mark, was there perhaps a reason not to add the method? -- assignee: -> skrah nosy: