Annoying octal notation

MRAB python at mrabarnett.plus.com
Fri Aug 21 12:58:25 EDT 2009


David wrote:
> Il Thu, 20 Aug 2009 22:24:24 +0200, Johannes Bauer ha scritto:
> 
>> David schrieb:
>>
>>> If I want an octal I'll use oct()! 
>>>
>>> "Explicit is better than implicit..."
>> A leading "0" *is* explicit.
> 
> It isn't explicit enough, at least IMO.
> 
Is this better?

Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit 
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
 >>> 010
   File "<stdin>", line 1
     010
       ^

I would've preferred it to be decimal unless there's a prefix:

Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit 
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
 >>> 0x10
16
 >>> 0o10
8

Ah well, something for Python 4. :-)



More information about the Python-list mailing list