On Sat, Mar 5, 2016 at 11:32 PM, Steven D'Aprano <[email protected]> wrote: > 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
Hmm. Thanks, Steve, as well as your detailed answer to the other question I posed tonight. On this thread, I am curious about one of the statements in the bug report you linked to: <quote> Author: Georg Brandl [...] Since the direction we're going is to allow leading zeros for all decimal literals in Python 4 (if it ever comes around), that's another reason for the status quo to win. </quote> Sounds like, in retrospect, Python 3 should have had this behavior implemented, but I am guessing that it was thought more important to emphasize the new octal literal syntax in Py 3 and eliminate the leading zero entirely (except for the special case of zero, which must have slipped through the cracks somehow). -- boB _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
