[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you all for your review. -- assignee: -> serhiy.storchaka resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker _

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 284026a8af9e by Serhiy Storchaka in branch 'default': Issue #25971: Optimized creating Fractions from floats by 2 times and from https://hg.python.org/cpython/rev/284026a8af9e -- nosy: +python-dev ___ Pyt

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Stefan Krah
Stefan Krah added the comment: Serhiy: to me, the patch also looks good, we can certainly change any error messages later. Back to the bikeshedding: Poly/ML: > f; Error-Value or constructor (f) has not been declared Found near f Static errors (pass2) ghci Prelude> f :2:1: N

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread R. David Murray
R. David Murray added the comment: 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 (whethe

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Stefan Krah
Stefan Krah added the comment: Sorry for the bikeshedding, but I find this interesting: Poly/ML (Cambridge), ghci (Glasgow) and OCaml (INRIA) appear to use error messages without a full stop but starting in uppercase. SML/NJ (Bell Labs) uses lowercase (and no full stop). Perhaps this is a Bri

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The question is wherever we should distinguish different sorts of infinities and NaNs (I think this is not needed). -- ___ Python tracker ___

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, this already was discussed in issue22364. The lowercase form wins with the score 4:1 (see msg226790, error messages use not only double quotes). -- ___ Python tracker _

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Stefan Krah
Stefan Krah added the comment: >From my non-native speaker's point of view, I'd use lowercase if the sentence doesn't end with a full stop, uppercase otherwise. When I started here I was told that error messages in Python usually don't have a full stop. ;) -- __

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Stefan Krah
Stefan Krah added the comment: Both versions are fine with me. The lowercase "cannot do ..." is more pervasive in the source tree: $ grep -R '"cannot' | wc -l 293 $ grep -R '"Cannot' | wc -l 150 If we change it, let's change all occurrences in _pydecimal and _decimal/docstrings.h to uppercase

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Any particular reason for the lower-casing of "Cannot" to "cannot" in the > exception messages? Only for matching current messages in C implementation of Decimal.as_integer_ratio(). As well as non-distinguishing positive and negative infinities, NaN and s

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-29 Thread Mark Dickinson
Mark Dickinson added the comment: Any particular reason for the lower-casing of "Cannot" to "cannot" in the exception messages? Otherwise, LGTM. -- ___ Python tracker ___ _

[issue25971] Optimize converting float and Decimal to Fraction

2015-12-28 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch makes following things: 1. Rewrite error messages in float.as_integer_ratio() and Python implementation of Decimal.as_integer_ratio() in more general form, not mentioning as_integer_ratio(), as in C implementation of Decimal.as_integer_ratio