[Tutor] Why does 01 give a syntax error, but 00 (or 00...0) does not?
Steven D'Aprano
steve at pearwood.info
Sun Mar 6 00:32:39 EST 2016
On Sat, Mar 05, 2016 at 05:20:21PM -0600, boB Stepp wrote:
> Why do zeros not give a syntax error, but other numbers with a leading
> zero do give a syntax error? An online search reveals that in Python
> 2 a leading 0 starts an octal number, but this was changed in Python
> 3. But then why is 00...0 valid, that is, does not give a syntax
> error?
No reason. It's just a historical accident, and with no real harm done,
people decided it's not worth fixing:
http://bugs.python.org/issue24668
--
Steve
More information about the Tutor
mailing list