[docs] [issue33039] int() and math.trunc don't accept objects that only define __index__
Rémi Lapeyre
report at bugs.python.org
Thu Feb 21 11:10:40 EST 2019
Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:
Yes it is. Thanks for finding that @Serhiy.
Since nobody objected to the change on the mailing list and people seem to agree in issue 20092:
[R. David Murray]
To summarize for anyone like me who didn't follow that issue: __index__ means the object can be losslessly converted to an int (is a true int), while __int__ may be an approximate conversion. Thus it makes sense for an object to have an __int__ but not __index__, but vice-versa does not make sense.
I will post my patch tonight.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33039>
_______________________________________
More information about the docs
mailing list