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

Guido van Rossum report at bugs.python.org
Sun Dec 15 23:50:45 CET 2013


Guido van Rossum added the comment:

I agree with Mark and Stafan.  Hex/oct/bin are only defined for integers.  __int__ is ambiguous -- it has the same problem as (int) in C in that it applies to floats and then loses the fraction.

I think the problem with Ethan's ternary logic is that it tries to act as an index and yet doesn't want to be an integer -- that doesn't make a lot of logical sense.  (You should use a dict to map from true/false/unknown, not a list of size three.)

----------
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed

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


More information about the Python-bugs-list mailing list