On 16.03.2016 01: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.
+1 The only reason to read up to two lines was to address the use of the shebang on Unix, not to be able to define two competing source code encodings :-) > On Tue, Mar 15, 2016 at 2:04 PM, Brett Cannon <br...@python.org> wrote: >> >> >> On Tue, 15 Mar 2016 at 13:31 Guido van Rossum <gu...@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.detect_encoding() 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). > > > -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Mar 16 2016) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ________________________________________________________________________ 2016-03-07: Released eGenix pyOpenSSL 0.13.14 ... http://egenix.com/go89 2016-02-19: Released eGenix PyRun 2.1.2 ... http://egenix.com/go88 ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ _______________________________________________ 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