[issue44547] fraction.Fraction does not implement __int__.
Josh Rosenberg
report at bugs.python.org
Thu Jul 1 22:25:52 EDT 2021
Josh Rosenberg <shadowranger+python at gmail.com> added the comment:
Seems like an equally reasonable solution would be to make class's with __trunc__ but not __int__ automatically generate a __int__ in terms of __trunc__ (similar to __str__ using __repr__ when the latter is defined but not the former). The inconsistency is in both methods existing, but having the equivalence implemented in int() rather than in the type (thereby making SupportsInt behave unexpectedly, even though it's 100% true that obj.__int__() would fail).
----------
nosy: +josh.r
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44547>
_______________________________________
More information about the Python-bugs-list
mailing list