[Python-ideas] Custom string prefixes
Devin Jeanpierre
jeanpierreda at gmail.com
Mon May 27 20:35:17 CEST 2013
On Mon, May 27, 2013 at 1:18 PM, Göktuğ Kayaalp
<goktug.kayaalp at gmail.com> wrote:
> A possible solution is:
>
> - In parse time, any string literal is a /raw string/, regardless of
> what prefix it has or if it even has a prefix.
>
> - The /raw string/ is then passed to user-land in this raw state,
> and then, if no prefix is applied, it is parsed as a standard
> string, otherwise the requested prefix is applied.
>
> - In case of a user-land raw string (e.g. r"yo"), the prefix
> function can be the identity function (e.g. f(x) = x).
>
> This is possibly not the most ideal solution, but it is a solution.
This is beginning to sound like E-style quasiliterals.
http://www.erights.org/elang/grammar/quasi-overview.html
-- Devin
More information about the Python-ideas
mailing list