Bug?

Artie Gold artiegold at austin.rr.com
Sun Mar 13 21:55:22 EST 2005


peter at clgus wrote:
> Hello
> 
> Ive recently found that you cannot type anything over 7 into a number that is preceded with a 0.
> ex:
>      >>> 01
>     1
>     >>> 07
>     7
>     >>> 08
>     SyntaxError: invalid token
>     >>> 011
>     9
>     >>> 017
>     15
>     >>> 077
>     63
>     >>> 078
>     SyntaxError: invalid token
> 
> I know this isnt that big of a problem,
> but i cannot think of one reason why they would not allow numbers preceded with a 0 to have a number
> higher then a 7 in them...
> And it seems very inconsistant to me...
> 
> Is there a reason for this?
> 

Yup. ;-)

Numbers beginning with a `0' are in octal (base 8), so only the digits 
`0' through `7' are valid.

HTH,
--ag

-- 
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays



More information about the Python-list mailing list