[issue1623] Implement PEP-3141 for Decimal

2008-01-12 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: The discussion on issue 1682 concluded that Decimal should not implement Real at all. -- resolution: -> rejected status: open -> closed __ Tracker <[EMAIL PROTECTED]> _

[issue1623] Implement PEP-3141 for Decimal

2008-01-08 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Yes, making Decimal subclass object instead of Real and Inexact makes it as fast as it used to be. ABCMeta.__instancecheck__ is easy to speed up, but after fixing it, we're still about 25% behind. So here'a version that just registers Decimal as a subclass inste

[issue1623] Implement PEP-3141 for Decimal

2008-01-07 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: _dec_from_triple: Probably, yes. It doesn't seem to have any practical effect, but it's good to be consistent. __lt__, __le__: It doesn't matter whether they're called because they have the same effect as __cmp__. They're only there to implement numbers.Real. P

[issue1623] Implement PEP-3141 for Decimal

2008-01-07 Thread Mark Dickinson
Mark Dickinson added the comment: Some more comments: (1) I don't think I understand the mechanism by which __lt__ and __le__ are supposed to be called. For example, by adding a few print statements it seems that the comparison Decimal(2) > 3 doesn't call __lt__ at any stage. Is this what

[issue1623] Implement PEP-3141 for Decimal

2008-01-07 Thread Mark Dickinson
Mark Dickinson added the comment: One minor point: Decimals are also created by the _dec_from_triple function: presumably that call to __new__ should also be changed to use super? __ Tracker <[EMAIL PROTECTED]> _

[issue1623] Implement PEP-3141 for Decimal

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Much smaller now. 3.0 will need an additional patch beyond the "automatic" forward port. -- versions: +Python 2.6 Added file: http://bugs.python.org/file9083/decimal-3141-just-trunc.patch __ Tracker <[EMAIL PROTECTED]> <

[issue1623] Implement PEP-3141 for Decimal

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I think this reflects the consensus of http://mail.python.org/pipermail/python-dev/2008-January/075798.html. I haven't yet implemented Context.round() as I suggested at http://mail.python.org/pipermail/python-dev/2008-January/075920.html because there are more d

[issue1623] Implement PEP-3141 for Decimal

2007-12-20 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Right. Will do. __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue1623] Implement PEP-3141 for Decimal

2007-12-20 Thread Guido van Rossum
Guido van Rossum added the comment: If there aren't too many differences between the 2.6 and 3.0 version of decimal.py and your patch, do 2.6 first, then the next time we merge stuff into 3.0 from the trunk it'll be forward-ported automatically. Though you'd have to start by backporting *numbers

[issue1623] Implement PEP-3141 for Decimal

2007-12-19 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Are you guys suggesting the backport before or after checking this in to the py3k branch? Either's fine with me. __ Tracker <[EMAIL PROTECTED]> __ ___

[issue1623] Implement PEP-3141 for Decimal

2007-12-19 Thread Guido van Rossum
Guido van Rossum added the comment: BTW abc.py and _abcoll.py have been backported to 2.6 already, I propose to backport numbers.py and test_abstract_numbers.py as well. __ Tracker <[EMAIL PROTECTED]>

[issue1623] Implement PEP-3141 for Decimal

2007-12-19 Thread Facundo Batista
Facundo Batista added the comment: I'm +1 to this change. As this does not negatively affect the behavior on Py2, for each part of the patch I propose: - decimal.py: incorporate them to the trunk - numbers.py: of course, in Py3 - test_decimal.py: incorporate this tests, activating them if in Py

[issue1623] Implement PEP-3141 for Decimal

2007-12-18 Thread Guido van Rossum
Guido van Rossum added the comment: Sorry, the PEP was approved, just not yet marked as such. :-) Will do so now. -- nosy: +gvanrossum resolution: postponed -> status: pending -> open __ Tracker <[EMAIL PROTECTED]> __

[issue1623] Implement PEP-3141 for Decimal

2007-12-18 Thread Facundo Batista
Facundo Batista added the comment: The PEP is not approved yet. This look interesting, will take a look again in the future after the PEP approval. Thanks for the work! Regards, -- resolution: -> postponed status: open -> pending __ Tracker <[EMAIL PRO

[issue1623] Implement PEP-3141 for Decimal

2007-12-17 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Re math.{floor,ceil}(float): oops, that's definitely a bug. I'll fix it. Re backporting: yes, and I believe trunc() should be backported too. __ Tracker <[EMAIL PROTECTED]>

[issue1623] Implement PEP-3141 for Decimal

2007-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: Cool! Works for me. I agree that it's not 100% clear that round(large_decimal) should return an integer rather than raising an exception. But, rightly or wrongly, this is what int(large_decimal) does at the moment, and it would be surprising to have int an

[issue1623] Implement PEP-3141 for Decimal

2007-12-15 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Here's a version of the patch that uses _rescale instead of quantize. I don't know enough about how contexts are used to know whether someone might want to know that ceil(Decimal("1e30")) gave a result with more precision than the input. On the other hand, the e

[issue1623] Implement PEP-3141 for Decimal

2007-12-14 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry: that was nonsense. trunc is fine---it's round, floor and ceil that fail on large arguments with this patch: >>> import decimal, math >>> math.floor(decimal.Decimal("1e30")) Traceback (most recent call last): File "", line 1, in File "/Users/dickin

[issue1623] Implement PEP-3141 for Decimal

2007-12-14 Thread Mark Dickinson
Mark Dickinson added the comment: I think you probably don't want to use quantize here: it makes use of the current context, which means (for example) that trunc(Decimal(integer_with_30_digits)) will fail with an InvalidOperation exception. I assume what's wanted is something that operate

[issue1623] Implement PEP-3141 for Decimal

2007-12-14 Thread Christian Heimes
Changes by Christian Heimes: -- assignee: -> facundobatista keywords: +patch, py3k nosy: +facundobatista priority: -> normal __ Tracker <[EMAIL PROTECTED]> __ ___

[issue1623] Implement PEP-3141 for Decimal

2007-12-13 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: I added __round__, __ceil__, __floor__, and __trunc__ -- components: Library (Lib) files: decimal_3141.patch messages: 58614 nosy: jyasskin severity: normal status: open title: Implement PEP-3141 for Decimal type: behavior versions: Python 3.0 Added f