[Python-Dev] PEP 292, Simpler String Substitutions
Fri, 21 Jun 2002 14:09:03 -0400
On Fri, Jun 21, 2002 at 11:57:50AM -0400, Michael McLay wrote:
> On Thursday 20 June 2002 06:48 pm, Ka-Ping Yee wrote:
> > On Thu, 20 Jun 2002, Oren Tirosh wrote:
> > > See http://tothink.com/python/embedpp
> > Hi Oren,
> > Your proposal brings up some valid concerns with PEP 215:
> > 1. run-time vs. compile-time parsing
> > 2. how to decide what's an expression
> > 3. balanced quoting instead of $
> I like Oren's PEP as a replacement for PEP 292. But there is one major
> problem with his notation. I would change the "`" character to something
> more readable.
Expression embedding, unlike interpolation, is done at compile time. This
would make it natural to use the same prefix used for inserting other kinds
of special stuff into strings at compile-time - the backslash.
print "X=\(x), Y=\(calc_y(x))."
No need for double backslash. No need for a special string prefix either
because \( currently has no meaning.