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 veky
Recipients Orborde, ezio.melotti, mark.dickinson, python-dev, rhettinger, veky
Date 2016-07-16.08:46:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468658803.68.0.338956548274.issue21136@psf.upfronthosting.co.za>
In-reply-to
Content
Unfortunately, this introduced a bug. It seems Mark Dickinson should go easier on his LGTMs. :-)

>>> import fractions
>>> fractions.Fraction(-1, 2) ** -1
Fraction(2, -1)

That is a really strange object, since it's not normalized, and many functions expect all Fractions to be. For example,

>>> _ == -2
False

Of course, the easy fix would be to change line 52 of fractions.py to _normalize=True - but that would reintroduce the slowness talked about in the original message. Alternative fix would be to be careful about sign of the base, which might be messy if we intend to be completely general -- for example, in finite quotient rings, fractions don't have well-defined signs. [I'm not quite sure why the code in fractions.py is so general, maybe someone really wanted such a level of generality. I don't, so I'd be fine with this working only on int/int Fractions.]
History
Date User Action Args
2016-07-16 08:46:43vekysetrecipients: + veky, rhettinger, mark.dickinson, ezio.melotti, python-dev, Orborde
2016-07-16 08:46:43vekysetmessageid: <1468658803.68.0.338956548274.issue21136@psf.upfronthosting.co.za>
2016-07-16 08:46:43vekylinkissue21136 messages
2016-07-16 08:46:43vekycreate