New submission from Michael Amrhein <mich...@adrhinum.de>:

While int, float, complex and Decimal implement __int__, Fraction does not. 
Thus, checking for typing.SupportsInt for fractions fails, although 
int(<fraction>) succeeds, because Fraction implements __trunc__.
This looks inconsistent.
Easiest fix seems to be: Fraction.__int__ = Fraction.__trunc__

----------
components: Library (Lib)
messages: 396827
nosy: mamrhein
priority: normal
severity: normal
status: open
title: fraction.Fraction does not implement __int__.
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to