<html>
<body>
I'm wondering if&nbsp;&nbsp; int('0x20')&nbsp;&nbsp; (without the
explicit radix value 16) should work.&nbsp; Doesn't the '0x' prefix mean
that it's a hex number, radix 16, unambiguously?<br><br>
OTOH, I would not expect&nbsp;&nbsp; int('033')&nbsp;&nbsp; to interpret
the value as if the radix is 8, because the &quot;leading 0 means
octal&quot; convention is both very old and a really really really bad
idea!&nbsp; But 0x prefix doesn't mean anything else -- does it?<br><br>
I'm waiting for the Pascal programmers to say that&nbsp;&nbsp;
int('$20')&nbsp;&nbsp; should work, returning 32, because $ is the
Pascal-language equivalent of '0x' -- but it shouldn't.&nbsp; To someone
entering data into a computer program, '$20' is not a value in hex, it's
an amount of money!<br><br>
At 10:26 AM 10/9/2006, Floris van Nee wrote<br>
<blockquote type=cite class=cite cite="">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.<br>
&nbsp;<br>
It is a bit weird though, that int(hex(20), 16) returns an error and I
think that should be fixed. [snip]<br>
&nbsp;<br>
On 10/9/06, <b>Sanghyeon Seo</b>
&lt;<a href="mailto:sanxiyn@gmail.com">sanxiyn@gmail.com</a>&gt; wrote:
<br>

<dl>
<dd>&gt;&gt;&gt; int('0x20', 16)<br>

<dd>ValueError: invalid integer number literal<br><br>

<dd>Same for long. Python library reference isn't clear on this point,
but <br>

<dd>my reading doesn't support this misfeature since one can use radix
0<br>

<dd>to the same effect. Anyway, there are codes out there depending
on<br>

<dd>this. :(<br><br>

<dd>--<br>

<dd>Seo Sanghyeon
</dl></blockquote></body>
<br>
<br>
J. Merrill / Analytical Software Corp</html>