A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-September/141472.html below:

Literal String Interpolation is ready for pronouncement

[Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncementNathaniel Smith njs at pobox.com
Sat Sep 5 21:23:49 CEST 2015
On Sep 5, 2015 11:32 AM, "Eric V. Smith" <eric at trueblade.com> wrote:
>
> > Actually, my current implementation doesn't use the lexer, although I
> > suppose it could. I'm currently manually scanning the string, keeping
> > track of strings and parens. To find the end of an expression, it looks
> > for a '!', ':', or non-doubled '}', not inside of a string or (), [], or
> > {}. There's a special case for '!=' so the bang isn't seen as ending the
> > expression.
>
> Ignore the part about non-doubled '}'. The actual description is:
>
> To find the end of an expression, it looks for a '!', ':', or '}', not
> inside of a string or (), [], or {}. There's a special case for '!=' so
> the bang isn't seen as ending the expression.

Sounds like you're reimplementing a lot of the lexer... I guess that's
doable, but how confident are you that your definition of "inside a string"
matches the original in all corner cases?

In any case the abstract language definition part should be phrased in
terms of the python lexer -- the expression ends when you encounter the
first } *token* that is not nested inside () [] {} *tokens*, and then you
can implement it however makes sense...

(This is then the same rule that patsy uses to find the end of python
expressions embedded inside patsy formula strings: patsy.readthedocs.org)

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150905/be8a70a1/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4