-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fraction('1e6') should be valid. #50062
Comments
When the Fractions module was first added to Python, it was decided that I think exponents should be permitted, for a couple of reasons: (1) consistency: there's a clearly-defined notion of a numeric string (2) Easy interactions with floats: with this addition, a Fraction can (3) Ease of parsing files containing numeric strings. (4) It's a very simple change! See attached patch. Jeffrey, any thoughts? |
Also, it would be nice if the Fraction constructor accepted both a |
This makes sense to me. It reminds me of the way that complex(real, |
Sounds good to me. I can't find any real objections to the new format in |
Fraction constructor modified to accept all numeric strings Leaving this open for Raymond's suggested change. |
Here's a patch for making Fraction(3, Fraction(4, 5)) valid. |
Hmm. That patch isn't quite right, in at least two respects
Here's an updated version, that also makes the default second argument |
Applied in r71832 (trunk), r71834 (py3k). One nice aspect of this change is that "Fraction(a, b)" is now |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: