%x unsigned?

D'Arcy J.M. Cain darcy at druid.net
Fri Mar 14 11:32:28 EDT 2008


On Fri, 14 Mar 2008 16:00:07 +0100
Hrvoje Niksic <hniksic at xemacs.org> wrote:
> The %x conversion specifier is documented in
> http://docs.python.org/lib/typesseq-strings.html as "Unsigned
> hexadecimal (lowercase)."  What does "unsigned" refer to?
> 
> >>> '0x%x' % 10
> '0xa'
> >>> '0x%x' % -10
> '0x-a'
> 
> Is this a bug or is %x misdocumented?

I think it is working exactly as documented.  It says that it displays
unsigned numbers.  If you give it a negative number you get undefined
behaviour.  Are you saying that the docs could be a little clearer?

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list