This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients ethan.furman, gvanrossum, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, skrah
Date 2013-12-16.02:04:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387159496.56.0.395213596474.issue19988@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2013-12-16 02:04:56ethan.furmansetrecipients: + ethan.furman, gvanrossum, rhettinger, mark.dickinson, pitrou, skrah, serhiy.storchaka
2013-12-16 02:04:56ethan.furmansetmessageid: <1387159496.56.0.395213596474.issue19988@psf.upfronthosting.co.za>
2013-12-16 02:04:56ethan.furmanlinkissue19988 messages
2013-12-16 02:04:55ethan.furmancreate