OTOH, I would not expect int('033') to interpret the value as if the radix is 8, because the "leading 0 means octal" convention is both very old and a really really really bad idea! But 0x prefix doesn't mean anything else -- does it?
I'm waiting for the Pascal programmers to say that int('$20') should work, returning 32, because $ is the Pascal-language equivalent of '0x' -- but it shouldn't. To someone entering data into a computer program, '$20' is not a value in hex, it's an amount of money!
At 10:26 AM 10/9/2006, Floris van Nee wrote
I just checked it myself to see what works and what doesn't. You're right that it doesn't work when putting '0x' in front of it. However, when I just do int('20', 16) it returns 32, which is correct.
It is a bit weird though, that int(hex(20), 16) returns an error and I think that should be fixed. [snip]
On 10/9/06, Sanghyeon Seo <[EMAIL PROTECTED]> wrote:
- >>> int('0x20', 16)
- ValueError: invalid integer number literal
- Same for long. Python library reference isn't clear on this point, but
- my reading doesn't support this misfeature since one can use radix 0
- to the same effect. Anyway, there are codes out there depending on
- this. :(
- --
- Seo Sanghyeon
J. Merrill / Analytical Software Corp
_______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com