On Thu, Mar 17, 2016 at 9:50 AM, Serhiy Storchaka wrote:
> On 17.03.16 16:55, Guido van Rossum wrote:
>>
>> On Thu, Mar 17, 2016 at 5:04 AM, Serhiy Storchaka
>> wrote:
Should we recommend that everyone use tokenize.detect_encoding()?
>>>
>>>
>>> Likely. However the interface of tokenize
On 03/17/2016 04:54 PM, Glenn Linderman wrote:
On 3/16/2016 12:59 AM, Serhiy Storchaka wrote:
Actually "must match the regular expression" is not correct, because
re.match() implies anchoring at the start. I have proposed more
correct regular expression in other branch of this thread.
"match
On 20 March 2016 at 07:46, Glenn Linderman wrote:
> Diagnosing ambiguous conditions, even including my example above, might be
> useful... for a few files... is it worth the effort? What % of .py sources
> have coding specifications? What % of those have two?
And there's a decent argument for lea
On 17.03.2016 15:02, Serhiy Storchaka wrote:
> On 17.03.16 15:14, M.-A. Lemburg wrote:
>> On 17.03.2016 01:29, Guido van Rossum wrote:
>>> Should we recommend that everyone use tokenize.detect_encoding()?
>>
>> I'd prefer a separate utility for this somewhere, since
>> tokenize.detect_encoding() is
On 17.03.16 15:14, M.-A. Lemburg wrote:
On 17.03.2016 01:29, Guido van Rossum wrote:
Should we recommend that everyone use tokenize.detect_encoding()?
I'd prefer a separate utility for this somewhere, since
tokenize.detect_encoding() is not available in Python 2.
I've attached an example impl
On 3/16/2016 12:59 AM, Serhiy Storchaka wrote:
On 16.03.16 09:46, Glenn Linderman wrote:
On 3/16/2016 12:09 AM, Serhiy Storchaka wrote:
On 16.03.16 08:34, Glenn Linderman wrote:
From the PEP 263:
More precisely, the first or second line must match the regular
expression "coding[:=]\s*([
On 3/19/2016 2:37 PM, Serhiy Storchaka wrote:
On 19.03.16 19:36, Glenn Linderman wrote:
On 3/19/2016 8:19 AM, Serhiy Storchaka wrote:
On 16.03.16 08:03, Serhiy Storchaka wrote:
I just tested with Emacs, and it looks that when specify different
codings on two different lines, the first coding wi
On 19.03.16 19:36, Glenn Linderman wrote:
On 3/19/2016 8:19 AM, Serhiy Storchaka wrote:
On 16.03.16 08:03, Serhiy Storchaka wrote:
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 s
On 17.03.2016 18:53, Serhiy Storchaka wrote:
> On 17.03.16 19:23, M.-A. Lemburg wrote:
>> On 17.03.2016 15:02, Serhiy Storchaka wrote:
>>> On 17.03.16 15:14, M.-A. Lemburg wrote:
On 17.03.2016 01:29, Guido van Rossum wrote:
> Should we recommend that everyone use tokenize.detect_encoding()
Glenn Linderman writes:
> On 3/19/2016 8:19 AM, Serhiy Storchaka wrote:
> > Therefore current CPython behavior can be correct, and the regular
> > expression in PEP 263 should be changed to use greedy repetition.
>
> Just because emacs works that way (and even though I'm an emacs user),
>
On 3/19/2016 8:19 AM, Serhiy Storchaka wrote:
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 seco
On 17.03.2016 01:29, Guido van Rossum wrote:
> I've updated the PEP. Please review. I decided not to update the
> Unicode howto (the thing is too obscure). Serhiy, you're probably in a
> better position to fix the code looking for cookies to pick the first
> one if there are two on the same line (o
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
doc
On 17.03.2016 15:55, Guido van Rossum wrote:
> On Thu, Mar 17, 2016 at 5:04 AM, Serhiy Storchaka wrote:
>>> Should we recommend that everyone use tokenize.detect_encoding()?
>>
>> Likely. However the interface of tokenize.detect_encoding() is not very
>> simple.
>
> I just found that out yesterda
On 17.03.16 21:11, Guido van Rossum wrote:
I tried this and it was too painful, so now I've just
changed the regex that mypy uses to use non-eager matching
(https://github.com/python/mypy/commit/b291998a46d580df412ed28af1ba1658446b9fe5).
\s* matches newlines.
{0,1}? is the same as ??.
__
On 3/16/2016 3:14 AM, Serhiy Storchaka wrote:
On 16.03.16 02: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.
Could you please also update the
On Thu, Mar 17, 2016 at 5:04 AM, Serhiy Storchaka wrote:
>> Should we recommend that everyone use tokenize.detect_encoding()?
>
> Likely. However the interface of tokenize.detect_encoding() is not very
> simple.
I just found that out yesterday. You have to give it a readline()
function, which is
On Thu, 17 Mar 2016 at 07:56 Guido van Rossum wrote:
> On Thu, Mar 17, 2016 at 5:04 AM, Serhiy Storchaka
> wrote:
> >> Should we recommend that everyone use tokenize.detect_encoding()?
> >
> > Likely. However the interface of tokenize.detect_encoding() is not very
> > simple.
>
> I just found th
On 17.03.16 21:11, Guido van Rossum wrote:
This will raise SyntaxError if the encoding is unknown. That needs to
be caught in mypy's case and then it needs to get the line number from
the exception.
Good point. "lineno" and "offset" attributes of SyntaxError is set to
None by tokenize.detect_e
On 3/16/2016 5:29 PM, Guido van Rossum wrote:
I've updated the PEP. Please review. I decided not to update the
Unicode howto (the thing is too obscure). Serhiy, you're probably in a
better position to fix the code looking for cookies to pick the first
one if there are two on the same line (or do
I've updated the PEP. Please review. I decided not to update the
Unicode howto (the thing is too obscure). Serhiy, you're probably in a
better position to fix the code looking for cookies to pick the first
one if there are two on the same line (or do whatever you think should
be done there).
Shoul
Guido van Rossum writes:
> > Should we recommend that everyone use tokenize.detect_encoding()?
+1
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/optio
On 17.03.16 02:29, Guido van Rossum wrote:
I've updated the PEP. Please review. I decided not to update the
Unicode howto (the thing is too obscure). Serhiy, you're probably in a
better position to fix the code looking for cookies to pick the first
one if there are two on the same line (or do wha
On 17.03.16 19:23, M.-A. Lemburg wrote:
On 17.03.2016 15:02, Serhiy Storchaka wrote:
On 17.03.16 15:14, M.-A. Lemburg wrote:
On 17.03.2016 01:29, Guido van Rossum wrote:
Should we recommend that everyone use tokenize.detect_encoding()?
I'd prefer a separate utility for this somewhere, since
On 17.03.16 16:55, Guido van Rossum wrote:
On Thu, Mar 17, 2016 at 5:04 AM, Serhiy Storchaka wrote:
Should we recommend that everyone use tokenize.detect_encoding()?
Likely. However the interface of tokenize.detect_encoding() is not very
simple.
I just found that out yesterday. You have to
On Wed, Mar 16, 2016 at 12:59 AM, M.-A. Lemburg wrote:
> 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 :-)
I know. I was just surprised that the PEP was sufficiently vague about
it that when
On 16.03.16 09:46, Glenn Linderman wrote:
On 3/16/2016 12:09 AM, Serhiy Storchaka wrote:
On 16.03.16 08:34, Glenn Linderman wrote:
From the PEP 263:
More precisely, the first or second line must match the regular
expression "coding[:=]\s*([-\w.]+)". The first group of this
expression
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
On 3/16/2016 12:09 AM, Serhiy Storchaka wrote:
On 16.03.16 08:34, Glenn Linderman wrote:
From the PEP 263:
More precisely, the first or second line must match the regular
expression "coding[:=]\s*([-\w.]+)". The first group of this
expression is then interpreted as encoding name. If t
On 16.03.16 02: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.
Could you please also update the regular expression in PEP 263 to
"^[ \t\v]*#.*
On 16.03.16 08:34, Glenn Linderman wrote:
From the PEP 263:
More precisely, the first or second line must match the regular
expression "coding[:=]\s*([-\w.]+)". The first group of this
expression is then interpreted as encoding name. If the encoding
is unknown to Python, an error i
On 3/15/2016 11:07 PM, Chris Angelico wrote:
On Wed, Mar 16, 2016 at 5:03 PM, 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 t
On Wed, Mar 16, 2016 at 2:07 AM, Chris Angelico wrote:
> Why would you ever have two coding cookies in a file? Surely this
> should be either an error, or ill-defined (ie parsers are allowed to
> pick whichever they like, including raising)?
>
> ChrisA
+1. If multiple coding cookies are found, an
On Wed, Mar 16, 2016 at 5:03 PM, 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 a
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
Guido van Rossum writes:
> 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, it never occurred to me that the specification could mean otherwise.
On reflection I can
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 wrote:
>
>
> On Tue, 15 Mar 2016 at 13:31 Guido van Rossum wrote:
>>
>> I cam
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
On Tue, Mar 15, 2016 at 01:30:08PM -0700, 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 th
On Tue, 15 Mar 2016 at 13:31 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 in
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. Do
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 followi
42 matches
Mail list logo