[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

Serhiy Storchaka report at bugs.python.org
Mon May 6 10:38:54 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

See also the discussion on the duplicated issue33039.

Few months ago I wrote the PR that makes constructors of int, float and complex to fall back to __index__ if corresponding special methods __int__, __float__ and __complex__ are not defined. I did not exposed it to public because binding __int__ to __index__ looks better to me. But perhaps some tests from that PR can be used in an alternate PR.

----------
components: +Interpreter Core
nosy: +serhiy.storchaka
versions: +Python 3.8 -Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue20092>
_______________________________________


More information about the Python-bugs-list mailing list