You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #24779 there are some speed regressions, which can be solved by using private attributes in magic methods.
Also, right now the fractions module code is using sometimes private attributes (_numerator and _denominator, e.g. in the __int__) and sometimes - public (numerator and denominator, e.g. in the __floor__). This looks not very consistent, at least.
Make some trivial performance optimizations in Fraction
Uses private class attributes `_numerator` and `_denominator` in place of the `numerator` and `denominator` property accesses.
Co-authored-by: hauntsaninja <[email protected]>
Adapted from
046c84e8f9
This makes arithmetic between Fractions with small components
just as fast as before #24779, at some expense of
mixed arithmetic (e.g. Fraction + int).
After #24779 there are some speed regressions, which can be solved by using private attributes in magic methods.
Also, right now the fractions module code is using sometimes private attributes (
_numerator
and_denominator
, e.g. in the__int__
) and sometimes - public (numerator
anddenominator
, e.g. in the__floor__
). This looks not very consistent, at least.Linked PRs
The text was updated successfully, but these errors were encountered: