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
Fix statistics.py after the Decimal.as_integer_ratio() change #70162
Comments
Here's a fix for the fallout from bpo-25928. I've set it to |
LGTM. I haven't tested that "type(x) is float or type(x) is Decimal" is faster than alternatives ("type(x) in (float, Decimal)", or "isinstance(x, (float, Decimal))", or "hasattr(x, 'as_integer_ratio')") and believe you have tested this. |
No, I haven't done any benchmarks. In a quick test type(x) == float |
The clear winner for float and Decimal is hasattr(x, 'as_integer_ratio'). |
I believe the current code is well-weighed compromise that optimize different cases ranged for their frequency of occurrence (floats, ints, decimals, fractions, subclasses of int, float, etc and independed numeric types). And new addition unlikely will change the balance too much, but we have to be aware. If Steven have no something to add, the patch LGTM. |
Ping. Just a reminder that it would be nice to get this into 3.6-alpha-1. :) |
statistics_as_integer_ratio.diff has been committed in 7b2fafd78c1d. |
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: