[TriZPUG] Python Wart?

Chris Calloway cbc at unc.edu
Thu Mar 19 00:36:33 CET 2015


 >>> 10
10
 >>> int('10')
10
 >>> 0xAA
170
 >>> int('0xAA')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '0xAA'
 >>> int('0xAA', 16)
170
 >>>

I have to specify the radix for perfectly valid literal int strings that 
aren't base 10? Boo. Int should parse literals in strings without hints 
just like the interpreter does.

-- 
Sincerely,

Chris Calloway, Applications Analyst
UNC Renaissance Computing Institute
100 Europa Drive, Suite 540, Chapel Hill, NC 27517
(919) 599-3530


More information about the TriZPUG mailing list