Ethan Furman added the comment:
For the record, the true/false values of my Logical type do convert to int,
just not the unknown value.
I agree using __int__ is dubious because of float (and Decimal, etc.), which
means really the only clean way to solve the issue (definitely for me, and for
any one else in a similar situation) is to bring back __hex__, __oct__, and,
presumably, __bin__.
To make things even worse, there is a discrepancy between hex() and %x, oct()
and %o:
--> hex(Unknown)
'0x2'
--> oct(Unknown)
'0o2'
--> '%x' % Unknown
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %x format: a number is required, not Logical
--> '%o' % Unknown
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %o format: a number is required, not Logical
Which is bizarre when one considers:
--> '%o' % Truth
'1'
So if '%o' fails, why doesn't oct()?
Do we reopen this issue, or start a new one?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com