This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients hac.man, mark.dickinson, skrah
Date 2012-09-08.07:57:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347091025.98.0.766946254476.issue15882@psf.upfronthosting.co.za>
In-reply-to
Content
> I'd call it a deviation from the specification then.
> Do you happen to know what the intention was?

Well, we're kinda outside the specification here.

Rightly or wrongly, Decimal('infinity').as_tuple() was originally implemented to return (0, (0,), 'F');  I'm fairly sure that was intentional, and I think that the Decimal constructor should continue to accept that tuple as a representation of infinity---else we're risking breaking existing code.

I think I may have muddied the waters at some later stage by modifying the constructor to ignore the second argument on input, so that (0, (), 'F') and (0, (0,), 'F') both work on input.  Or maybe it was already the case that the second argument was ignored;  I'm not sure about that.

I do agree that (0, (), 'F') is a better representation of infinity, and it would have been a little better if that had been used from the start, but I don't think it's worth the potential breakage or the deprecation cycles involved in 'fixing' this.


If it helps at all, it would probably be safe to disallow tuples other than () and (0,);  I doubt anyone's intentionally passing anything else here.

So:

+1 on allowing ((0, (0,), 'F')) as input in _decimal.  I do see this report as a regression from 3.2 that should be fixed.

-0 on changing Infinity.as_tuple() to (0, (), 'F'), and perhaps then deprecating ((0, (0,), 'F') as a legal input.
History
Date User Action Args
2012-09-08 07:57:06mark.dickinsonsetrecipients: + mark.dickinson, skrah, hac.man
2012-09-08 07:57:05mark.dickinsonsetmessageid: <1347091025.98.0.766946254476.issue15882@psf.upfronthosting.co.za>
2012-09-08 07:57:05mark.dickinsonlinkissue15882 messages
2012-09-08 07:57:04mark.dickinsoncreate