[Python-Dev] What does a double coding cookie mean?
python at mrabarnett.plus.com
Tue Mar 15 16:53:34 EDT 2016
On 2016-03-15 20: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
I think it should follow CPython.
As I see it, CPython allows it to be on the second line because the
first line might be needed for the shebang.
If the first two lines both had an encoding, and then you inserted a
shebang line, the second one would be ignored anyway.
More information about the Python-Dev