Bengt Richter wrote:
>>> hex(-2*0x40000000+0x40047a80)
__main__:1: FutureWarning: hex()/oct() of negative int will return a signed
string in Python 2.4
and up
'0xc0047a80'
That "signed string" is a unary minus expression using an absolute value forced
by the inadequacy
of the literal representation syntax.
IOW, IMO '-' + hex_literal_of(abs(x)) is not a decent hex_literal_of(-x) !!
This has been discussed over and over, but since you bring it up again:
There are no hex literals for negative numbers, just as there are no
decimal literals for negative number. A literal, by nature, in any
base, is non-negative.
If you disagree: Is 0xFFF6 a positive or a negative number?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list