Author mark.dickinson
Recipients mark.dickinson, rhettinger
Date 2010-04-02.20:42:38
SpamBayes Score 1.10903e-05
Marked as misclassified No
Message-id <1270240962.97.0.707473120534.issue8294@psf.upfronthosting.co.za>
In-reply-to
Content
Here's a patch that allows direct construction of a Fraction instance from a float or Decimal instance, performing an exact conversion in either case.

>>> from fractions import Fraction
>>> from decimal import Decimal
>>> Fraction(1.1)
Fraction(2476979795053773, 2251799813685248)
>>> Fraction(Decimal('1.1'))
Fraction(11, 10)
>>> Fraction(Decimal(1.1))
Fraction(2476979795053773, 2251799813685248)
History
Date User Action Args
2010-04-02 20:42:43mark.dickinsonsetrecipients: + mark.dickinson, rhettinger
2010-04-02 20:42:42mark.dickinsonsetmessageid: <1270240962.97.0.707473120534.issue8294@psf.upfronthosting.co.za>
2010-04-02 20:42:41mark.dickinsonlinkissue8294 messages
2010-04-02 20:42:41mark.dickinsoncreate