Re: [IronPython] int() and long() incompatibility

2006-10-09 Thread Dino Viehland
09, 2006 7:12 AM To: Discussion of IronPython Subject: [IronPython] int() and long() incompatibility >>> 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 thi

Re: [IronPython] int() and long() incompatibility

2006-10-09 Thread Floris van Nee
Yeh, I thought of that as well (a few days ago actually ;)), but that doesn't work in CPython as well. To my knowledge the 0x prefix is only used to indicate it's a hexadecimal number, so I too thought why I had to give 16 as an argument as well. But that's not really in the scope of this list, as

Re: [IronPython] int() and long() incompatibility

2006-10-09 Thread J. Merrill
I'm wondering if   int('0x20')   (without the explicit radix value 16) should work.  Doesn't the '0x' prefix mean that it's a hex number, radix 16, unambiguously? 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

Re: [IronPython] int() and long() incompatibility

2006-10-09 Thread Floris van Nee
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

[IronPython] int() and long() incompatibility

2006-10-09 Thread Sanghyeon Seo
>>> 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