[Python-Dev] PEP 215 redux: toward a simplified consensus?

M.-A. Lemburg mal@lemburg.com
Mon, 25 Feb 2002 19:08:48 +0100


"Barry A. Warsaw" wrote:
> 
> Background: PEP 215 has some interesting ideas, but IMHO is more than
> I'm comfortable with.  At IPC10, Guido described his rules for string
> interpolation as they would be if his time machine were more powerful.
> These follow some discussions we've had during various Zope sprints
> about making the rules simpler for non-programmers to understand.
> I've also been struggling with how error prone %(var)s substitutions
> can be in the thru-the-web Mailman strings where this is supported.
> Here's what I've come up with.
> 
> Guido's rules for $-substitutions are really simple:
> 
> 1. $$ substitutes to just a single $
> 
> 2. $identifier followed by non-identifier characters gets interpolated
>    with the value of the 'identifier' key in the substitution
>    dictionary.
> 
> 3. For handling cases where the identifier is followed by identifier
>    characters that aren't part of the key, ${identfier} is equivalent
>    to $identifier.
> 
> And that's it.  For the sake of discussion, forget about where the
> dictionary for string interpolation comes from.

Wouldn't it be a lot simpler and more inline with what we
already have, if we'd use '%' as escape characters ?

1. %% becomes %

2. %ident maps to %(ident)s as we have it now

3. %{ident} maps to %(ident)s

4. %(ident)s continues to have the same semantics as
   before

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/