[Python-Dev] What does a double coding cookie mean? (original) (raw)
Guido van Rossum guido at python.org
Tue Mar 15 20:28:05 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 ]
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.
On Tue, Mar 15, 2016 at 2:04 PM, Brett Cannon <brett at python.org> wrote:
On Tue, 15 Mar 2016 at 13:31 Guido van Rossum <guido at python.org> 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 I think the spirit of PEP 263 is for the first specified encoding to win as the support of two lines is to support shebangs and not multiple encodings :) . I also think the fact that tokenize.detectencoding() doesn't automatically read two lines from its input also suggests the intent is "first encoding wins" (and that is the semantics of the function).
-- --Guido van Rossum (python.org/~guido)
- 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 ]