[Python-Dev] What does a double coding cookie mean? (original) (raw)

Serhiy Storchaka storchaka at gmail.com
Wed Mar 16 03:14:05 EDT 2016


On 16.03.16 02:28, Guido van Rossum wrote:

I agree that the spirit of the PEP is to stop at the first coding cookie found. Would it be okay if I updated the PEP to clarify this? I'll definitely also update the docs.

Could you please also update the regular expression in PEP 263 to "^[ \t\v]#.?coding[:=][ \t]*([-.a-zA-Z0-9]+)"?

Coding cookie must be in comment, only the first occurrence in the line must be taken to account (here is a bug in CPython), encoding name must be ASCII, and there must not be any Python statement on the line that contains the encoding declaration. [1]

[1] https://bugs.python.org/issue18873



More information about the Python-Dev mailing list