[Python-Dev] Boundaries between numbers and identifiers

Lukasz Langa lukasz at langa.pl
Thu Apr 26 15:02:22 EDT 2018


> On Apr 26, 2018, at 11:37 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 
> I propose to change the Python syntax by adding a requirement that there should be a whitespace or delimiter between a numeric literal and the following keyword.

-1

This would make Python 3.8 reject code due to stylistic preference. Code that it actually can unambiguously parse today.

I agree that a formatting style that omits whitespace between numerals and other tokens is terrible.  However, if you start downright rejecting it, you will likely punish the wrong people.  Users of third-party libraries will be met with random parsing errors in files they have no control over.  This is not helpful.

And given BPO-33338 the standard library tokenizer would have to keep parsing those things as is.

Making 0or[] working again is also not worth it since that's been broken since Python 2.6 and hopefully nobody is running Python 2.5-only code anymore.

What we should instead is to make the standard library tokenizer reflect the behavior of Python 2.6+.

-- Ł


More information about the Python-Dev mailing list