[issue19988] hex() and oct() use __index__ instead of __int__

Antoine Pitrou report at bugs.python.org
Sun Dec 15 18:28:32 CET 2013


Antoine Pitrou added the comment:

Indeed, the definition and use of __index__ has derived since PEP 357. Nowadays, __index__ means "can be converted to an int without loss".

In any case, I find the behaviour of your "logical type" a bit dubious. If it's like bool but ternary, it *should* convert to int (or perhaps be an int subclass like bool).

----------
nosy: +pitrou

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


More information about the Python-bugs-list mailing list