On 2016-03-15 20:53, MRAB wrote:
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.

A further thought: is mypy just assuming that the first line contains the shebang?

If there's only one encoding line, and it's the first line, does mypy still get it right?

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to