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 jyasskin, mark.dickinson, rhettinger
Date 2009-04-22.21:41:33
SpamBayes Score 8.062717e-12
Marked as misclassified No
Message-id <1240436497.79.0.981462595325.issue5812@psf.upfronthosting.co.za>
In-reply-to
Content
Hmm.  That patch isn't quite right, in at least two respects

 - if the single-argument constructor is using LBYL (i.e., an
   explicit isinstance(x, Rational), then the two-argument
   constructor should too.
 - the zero-division check should come *after* the type check;
   that is, Rational(1, 0j) should raise TypeError rather than
   ZeroDivisionError.

Here's an updated version, that also makes the default second argument 
None rather than 1 and uses an 'is None' instead of '== 1' to determine 
number of arguments;  this means that Fraction(3, 1.0) is no longer 
valid.
History
Date User Action Args
2009-04-22 21:41:38mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, jyasskin
2009-04-22 21:41:37mark.dickinsonsetmessageid: <1240436497.79.0.981462595325.issue5812@psf.upfronthosting.co.za>
2009-04-22 21:41:35mark.dickinsonlinkissue5812 messages
2009-04-22 21:41:35mark.dickinsoncreate