Numeric literals in other than base 10 - was Annoying octal notation

Mel mwilson at the-wire.com
Mon Aug 24 09:05:24 EDT 2009


James Harris wrote:

> On 24 Aug, 02:19, Max Erickson <maxerick... at gmail.com> wrote:
[ ... ]
>> >>> int('100', 3)
>> 9
>> >>> int('100', 36)
>> 1296
> 
> This is fine typed into the language directly but couldn't be entered
> by the user or read-in from or written to a file.

That's rather beside the point.  Literals don't essentially come from files 
or user input.  Essentially literals are a subset of expressions, just like 
function calls are, and they have to be evaluated by Python to yield a 
value.  I'm not averse to 32'rst', but we already have

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int ('rst', 32)
28573

	Mel.

> 
> James





More information about the Python-list mailing list