[Tutor] built-in hex->int question

Kalle Svensson kalle@gnupung.net
Tue, 8 Jan 2002 01:18:27 +0100


[Huuuuuu]
> Why understands the float() function a string argument but not 
> integer-cast-functions?

You mean why does float() understand *hexadecimal* string arguments.  I don't
know the answer, but:

>>> int("4")
4
>>> int("0xaf", 16)
175
>>> long("0xaf", 16)
175L

Peace,
  Kalle
-- 
Kalle Svensson (kalle@gnupung.net) - Laziness, impatience, hubris: Pick two!
English: http://www.gnupung.net/  Svenska: http://www.lysator.liu.se/~kalle/
Stuff: ["http://www.%s.org/" % x for x in "gnu debian python emacs".split()]