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

R. David Murray report at bugs.python.org
Sun Dec 29 03:19:26 CET 2013


R. David Murray added the comment:

It is not clear to me that that would be correct, though.  Isn't the whole point of __index__ that some types can act as indicies even though they are *not* integers?  Shouldn't it be up to the type to decide if converting them to int is a sensible thing to do?  Maybe that's being silly/pendantic, though.  On the gripping hand, it feels like this is another case of what you have pointed out elsewhere, that it is not clear that we actually have a consistent API here...

----------
nosy: +r.david.murray

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


More information about the Python-bugs-list mailing list