[Python-Dev] What does a double coding cookie mean? (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Sat Mar 19 11:19:25 EDT 2016
- Previous message (by thread): [Python-Dev] What does a double coding cookie mean?
- Next message (by thread): [Python-Dev] What does a double coding cookie mean?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 16.03.16 08:03, Serhiy Storchaka wrote:
On 15.03.16 22:30, Guido van Rossum wrote:
I came across a file that had two different coding cookies -- one on the first line and one on the second. CPython uses the first, but mypy happens to use the second. I couldn't find anything in the spec or docs ruling out the second interpretation. Does anyone have a suggestion (apart from following CPython)?
Reference: https://github.com/python/mypy/issues/1281 There is similar question. If a file has two different coding cookies on the same line, what should win? Currently the last cookie wins, in CPython parser, in the tokenize module, in IDLE, and in number of other code. I think this is a bug.
I just tested with Emacs, and it looks that when specify different codings on two different lines, the first coding wins, but when specify different codings on the same line, the last coding wins.
Therefore current CPython behavior can be correct, and the regular expression in PEP 263 should be changed to use greedy repetition.
- Previous message (by thread): [Python-Dev] What does a double coding cookie mean?
- Next message (by thread): [Python-Dev] What does a double coding cookie mean?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]