Message206275
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? |
|
Date |
User |
Action |
Args |
2013-12-16 02:04:56 | ethan.furman | set | recipients:
+ ethan.furman, gvanrossum, rhettinger, mark.dickinson, pitrou, skrah, serhiy.storchaka |
2013-12-16 02:04:56 | ethan.furman | set | messageid: <1387159496.56.0.395213596474.issue19988@psf.upfronthosting.co.za> |
2013-12-16 02:04:56 | ethan.furman | link | issue19988 messages |
2013-12-16 02:04:55 | ethan.furman | create | |
|