Re: python strings

Daniel LaLiberte (liberte@ncsa.uiuc.edu)
Thu, 21 Apr 94 10:00:39 CDT

From: Tim Peters <tim@ksr.com>

[...] Everyone
who enters this thread wants it done in a different way, and will think
of more useful variations the day after a feeble compromise is
released (if that happens at all ...). This is good! It's bad only if
we can't implement our latest grand schemes ourselves.

Here is a grand scheme idea that comes from the Lisp world.

Backquote is the Lisp analog of here-is input with full expression
evaluation possible, not just variable substitution. Unquoted
expressions within backquoted expressions are evaluated and the
result is used instead. Nested backquotes, unquotes, and regular
quotes make things even more interesting.

Backquote is often used to construct Lisp expressions for macro
expansions which are then evaluated, but it may be used anywhere list
structures are constructed.

Python has no macros, but one can parse text and evaluate it at run time.
So aids to the construction of expressions would be useful.

But I would use it for constructing HTML text as the result of CGI
scripts. I am using Perl for that now, but I have to preevaluate
expressions and store the results in variables. Not so serious, but it
feels like doing without anonymous functions.

I'd be delighted if I could implement a backquote-like facility in
Python. I wouldn't expect it to be built-in.

dan