[Python-ideas] Draft PEP on string interpolation
Nathaniel Smith
njs at pobox.com
Mon Aug 24 22:44:02 CEST 2015
On Mon, Aug 24, 2015 at 10:38 AM, Guido van Rossum <guido at python.org> wrote:
> I cannot accept $ interpolation in the language definition. I also don't
> want PEP 498 and 501 to use different interpolation syntaxes. So to me, this
> means that i18n is off the table as a motivation for PEP 501 (it never was
> on the table for 498), and Nick can focus on motivational examples from
> html/sql/shell code injection for PEP 501 (but only if he can live with the
> PEP 498 surface syntax for interpolation).
>From the early part of this discussion [1], I had the impression that
the goal was that eventually string interpolation would be on by
default for all strings, with PEP 498 intended as an intermediate step
towards that goal. Is that still true, or is the plan now that
interpolated strings will always require an explicit marker (like
'f')?
I ask because if they *do* require an explicit marker, then obviously
the best thing is for the syntax to match that of .format. But, if
this will be enabled for all strings in Python 3.something, then it
seems like we should be careful now to make sure that the syntax is
clearly distinct from that used for .format ("${...}" or "\{...}" or
...), because anything else creates nasty compatibility problems for
people trying to write format template strings that work on both old
and new Pythons.
(This is also assuming that f-string interpolation and the eventual
plain-old-string interpolation will use the same syntax, but that
seems like a highly desirable property to me..)
-n
[1] http://thread.gmane.org/gmane.comp.python.ideas/34980
--
Nathaniel J. Smith -- http://vorpus.org
More information about the Python-ideas
mailing list