[issue19995] hex() and %x, oct() and %o do not behave the same

Antoine Pitrou report at bugs.python.org
Mon Dec 16 23:15:20 CET 2013


Antoine Pitrou added the comment:

> Antoine, if I understand you correctly, you are saying that any type
> that defines __index__ is an integer, and should therefore also define
> __int__, in which case Python can just use __int__ and not worry about
> __index__?

... is an integer-like, yes.

> While I am beginning to agree that an integer type needs to implement
> both __int__ and __index__, it still remains true that Python needs to
> call __index__ if what it needs is already a real, true int, and not
> just something that can be truncated or otherwise converted into an
> int -- such as float.

Of course.

----------

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


More information about the Python-bugs-list mailing list