Message261227
The language reference carves out a special case for decimal zero literals: they may have leading “0” digits. Non-zero decimal literals may not. This is apparently deliberate:
Note that leading zeros in a non-zero decimal number are not allowed. This is for disambiguation with C-style octal literals, which Python used before version 3.0.
reference/lexical_analysis.html#integer-literals
But the expressed rationale (“for disambiguation with C-style octal literals”) does not explain making decimal zero special compared with non-zero.
Is there a good reason for this inconsistency::
0000 # valid syntax for zero literal
0003 # SyntaxError
0123 # SyntaxError
To my reading, they should all cause SyntaxError. What is the rationale for the special case of the first one? |
|
Date |
User |
Action |
Args |
2016-03-05 23:58:36 | bignose | set | recipients:
+ bignose |
2016-03-05 23:58:36 | bignose | set | messageid: <1457222316.54.0.23701049885.issue26490@psf.upfronthosting.co.za> |
2016-03-05 23:58:36 | bignose | link | issue26490 messages |
2016-03-05 23:58:35 | bignose | create | |
|