-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Optimize converting float and Decimal to Fraction #70159
Comments
Proposed patch makes following things:
This speeds up creating a Fraction from float and Decimal 2 to 3 times. |
Any particular reason for the lower-casing of "Cannot" to "cannot" in the exception messages? Otherwise, LGTM. |
Only for matching current messages in C implementation of Decimal.as_integer_ratio(). As well as non-distinguishing positive and negative infinities, NaN and sNaN. If this is desirable, exception messages in C implementation of Decimal.as_integer_ratio() should be changed too. |
Both versions are fine with me. The lowercase "cannot do ..." is more $ grep -R '"cannot' | wc -l
293
$ grep -R '"Cannot' | wc -l
150 If we change it, let's change all occurrences in _pydecimal and |
From my non-native speaker's point of view, I'd use lowercase if When I started here I was told that error messages in Python |
The question is wherever we should distinguish different sorts of infinities and NaNs (I think this is not needed). |
Sorry for the bikeshedding, but I find this interesting: Poly/ML (Cambridge), ghci (Glasgow) and OCaml (INRIA) appear to SML/NJ (Bell Labs) uses lowercase (and no full stop). Perhaps this is a British/European vs. American issue? Regarding int/-inf: I don't think it's important to distiguish |
I wonder if it is a (programming) language specific thing. On the other hand, I don't know what those langauges error messages look like, but Python's normally follow a colon (ValueError: ....) where not having the message capitalized is more natural (whether or not there is a full stop at the end), at least in American English. |
Serhiy: to me, the patch also looks good, we can certainly change Back to the bikeshedding: Poly/ML:
ghci <interactive>:2:1: Not in scope: `f' OCaml # f;; SML/NJ
Basically the European languages start in uppercase after the |
New changeset 284026a8af9e by Serhiy Storchaka in branch 'default': |
Thank you all for your review. |
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: