[issue5812] Fraction('1e6') should be valid.

2009-04-24 Thread Mark Dickinson
Mark Dickinson added the comment: Applied in r71832 (trunk), r71834 (py3k). One nice aspect of this change is that "Fraction(a, b)" is now a safe alternative to "a/b" in places where a and b might be either Fractions or integers. -- resolution: -> accepted stage: patch review -> commi

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
Mark Dickinson added the comment: 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 t

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
Mark Dickinson added the comment: Here's a patch for making Fraction(3, Fraction(4, 5)) valid. It's against the trunk. -- stage: needs patch -> patch review Added file: http://bugs.python.org/file13739/fraction_of_fractions.patch ___ Python tracker

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
Changes by Mark Dickinson : -- stage: patch review -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
Mark Dickinson added the comment: Fraction constructor modified to accept all numeric strings in r71806 (py3k), 71808 (trunk). Leaving this open for Raymond's suggested change. -- ___ Python tracker __

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Sounds good to me. I can't find any real objections to the new format in issue 1682, just me complaining that it might be feature creep. -- ___ Python tracker

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
Mark Dickinson added the comment: > Also, it would be nice if the Fraction constructor accepted both a > numerator and denominator that we also fractions. This makes sense to me. It reminds me of the way that complex(real, imag) allows real and imag to be complex numbers, and does the 'right t

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also, it would be nice if the Fraction constructor accepted both a numerator and denominator that we also fractions. This came up in a demonstration of continued fractions and it bombed when the denominator was not allowed to be a Fraction itself. The meani

[issue5812] Fraction('1e6') should be valid.

2009-04-22 Thread Mark Dickinson
New submission from Mark Dickinson : When the Fractions module was first added to Python, it was decided that when constructing from a string, decimal strings should be allowed, but not those including an exponent. For example, Fraction('1.1') is currently valid, but Fraction('1.1e6') is not. I