Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-09 Thread Eric V. Smith
On 11/9/2016 11:35 AM, Paul Moore wrote: On 9 November 2016 at 16:20, Fabio Zadrozny wrote: Also, as a feedback, I found it a bit odd that there can't be any space nor new line between the last format specifiers and '}' FWIW, that is the case for normal format strings, as well: print("{!r\n

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-09 Thread Paul Moore
On 9 November 2016 at 16:20, Fabio Zadrozny wrote: > Also, as a feedback, I found it a bit odd that there can't be any space nor > new line between the last format specifiers and '}' FWIW, that is the case for normal format strings, as well: >>> print("{!r\n}".format(12)) Traceback (most recent

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-09 Thread Fabio Zadrozny
On Sat, Nov 5, 2016 at 10:36 AM, Nick Coghlan wrote: > On 5 November 2016 at 04:03, Fabio Zadrozny wrote: > > On Fri, Nov 4, 2016 at 3:15 PM, Eric V. Smith > wrote: > >> Using PyParser_ASTFromString is the easiest possible way to do this. > Given > >> a string, it returns an AST node. What coul

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-05 Thread Nick Coghlan
On 5 November 2016 at 04:03, Fabio Zadrozny wrote: > On Fri, Nov 4, 2016 at 3:15 PM, Eric V. Smith wrote: >> Using PyParser_ASTFromString is the easiest possible way to do this. Given >> a string, it returns an AST node. What could be simpler? > > > I think that for implementation purposes, given

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Eric V. Smith
On 11/4/2016 2:03 PM, Fabio Zadrozny wrote: Using PyParser_ASTFromString is the easiest possible way to do this. Given a string, it returns an AST node. What could be simpler? ​I think that for implementation purposes, given the python infrastructure, it's fine, but for specification p

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Fabio Zadrozny
On Fri, Nov 4, 2016 at 3:15 PM, Eric V. Smith wrote: > On 11/4/2016 10:50 AM, Fabio Zadrozny wrote: > >> In what way do you think the implementation isn't ready for a final >> release? >> >> >> Well, the cases listed in the docs​ >> (https://hg.python.org/cpython/file/default/Doc/referenc

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Eric V. Smith
On 11/4/2016 10:50 AM, Fabio Zadrozny wrote: In what way do you think the implementation isn't ready for a final release? Well, the cases listed in the docs​ (https://hg.python.org/cpython/file/default/Doc/reference/lexical_analysis.rst

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Fabio Zadrozny
Answers inline... On Fri, Nov 4, 2016 at 5:56 AM, Eric V. Smith wrote: > On 11/3/2016 3:06 PM, Fabio Zadrozny wrote: > >> Hi Python-Dev, >> >> I'm trying to get my head around on what's accepted in f-strings -- >> https://www.python.org/dev/peps/pep-0498/ seems very light on the >> details on wh

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Paul Moore
On 4 November 2016 at 08:36, Simon Cross wrote: > On Fri, Nov 4, 2016 at 9:56 AM, Eric V. Smith wrote: >> 2. The parser sees that it's an f-string, and breaks it into expression and >> text parts. > > I'm with Fabio here. It would be really nice to have a grammar > specified and documented for th

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Simon Cross
On Fri, Nov 4, 2016 at 9:56 AM, Eric V. Smith wrote: > 2. The parser sees that it's an f-string, and breaks it into expression and > text parts. I'm with Fabio here. It would be really nice to have a grammar specified and documented for this step, even if it's not implemented that way. Otherwise

Re: [Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-04 Thread Eric V. Smith
On 11/3/2016 3:06 PM, Fabio Zadrozny wrote: Hi Python-Dev, I'm trying to get my head around on what's accepted in f-strings -- https://www.python.org/dev/peps/pep-0498/ seems very light on the details on what it does accept as an expression and how things should actually be parsed (and the curre

[Python-Dev] Parsing f-strings from PEP 498 -- Literal String Interpolation

2016-11-03 Thread Fabio Zadrozny
Hi Python-Dev, I'm trying to get my head around on what's accepted in f-strings -- https://www.python.org/dev/peps/pep-0498/ seems very light on the details on what it does accept as an expression and how things should actually be parsed (and the current implementation still doesn't seem to be in