Leading 0's syntax error in datetime.date module (Python 3.6)

Ian Kelly ian.g.kelly at gmail.com
Thu May 10 12:59:36 EDT 2018


On Thu, May 10, 2018 at 5:49 AM, D'Arcy Cain <darcy at vybenetworks.com> wrote:
> On 2018-05-10 07:28 AM, Skip Montanaro wrote:
>> https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax
>
> Funny stuff:
>
> Python could either:
>
>     1. silently do the wrong thing...
>     2. immediately disabuse him...
>     3. let him continue to think...
>
> Some people passionately believe that (c) is the correct answer
>
> I guess <OL> uses letters in the writer's browser.

That's not even the strongest reason for disallowing leading zeroes
rather than silently changing them to decimal. It should be disallowed
simply because the meaning was previously different.

If I have programs that use 0775 expecting it to be equivalent to
0b111111101, and it suddenly changes to 775 when I upgrade to Python
3, that's going to silently introduce weird bugs into my program,
whereas disallowing it means that I immediately get a SyntaxError and
will know to fix it. It's mystifying to me that the PEP doesn't
discuss this transitional issue at all.



More information about the Python-list mailing list