[Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement (original) (raw)

Eric V. Smith eric at trueblade.com
Sat Sep 5 20:31:21 CEST 2015


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.

Eric.



More information about the Python-Dev mailing list