[Python-Dev] PEP 215 redux: toward a simplified consensus? (original) (raw)

Fredrik Lundh fredrik@pythonware.com
Mon, 25 Feb 2002 22:59:14 +0100


barry wrote:

From a /non-programmer's/ point of view, %(var)s is way too error prone, and $-strings are an attempt at implementing a simple to explain, hard to get wrong, rule for thru-the-web supplied template strings.

how about making that "s" optional?

1. %% substitutes to just a single %

2. %(identifier) followed by non-identifier characters gets
interpolated with the value of the 'identifier' key in the sub-
stitution dictionary.

3. For handling cases where the identifier is followed by
identifier characters that aren't part of the key, $(identfier)s
is equivalent to %(identifier)