Why does 000 evaluate to 0 in Python 3?
Since the octal prefix is now 0o in Python 3 it's not legal to write 0777 any more. Okay. So why is it legal to write 00 which evaluates properly to 0 whereas other digits trigger a syntax error? >>> 01 ... File "<interactive input>", line 1 01 ^ SyntaxError: invalid token >>> >>> 00 0 If one takes a look at the Lexical Analysis (Integer Literal Section) page: integer ::= decinteger | bininteger | octinteger | hexinteger decinteger ::= nonzerodigit (["_"] digit)* | "0"+(["_"] "0")* ... So that means that a decinteger either begins with a nonzero digit (followed by all possible digits and