[Python-ideas] Disallow "00000" as a synonym for "0"

Georg Brandl g.brandl at gmx.net
Fri Jul 17 20:33:55 CEST 2015


On 07/17/2015 05:22 PM, Steven D'Aprano wrote:

> Why was it defined that way? The more obvious:
> 
> decimalinteger ::=  nonzerodigit digit* | "0"
> 
> was the definition in Python 2. As the Stackoverflow post above points 
> out, the definition of decimalinteger actually in use seems to violate 
> PEP 3127, and supporting "0"+ was added as a special case by Georg 
> Brandl.
> 
> Since leading 0 digits in decimal int literals are prohibited, we cannot 
> write 0001, 0023 etc. Why would we write 0000 to get zero?

I could tell you, but then I'd have to kill you.

Georg



More information about the Python-ideas mailing list