[Python-Dev] PEP 215 redux: toward a simplified consensus? (original) (raw)
Guido van Rossum guido@python.org
Mon, 25 Feb 2002 13:33:32 -0500
- Previous message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Next message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Barry]
> 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.
[MAL]
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
That's not simpler, it's more complicated. Any tool dealing with these will have to understand all the rules.
The point of switching to $ is twofold: (1) it avoids confusion with the old %-based syntax (which can continue to exist for different purposes), (2) it is familiar to people who have seen substitution in other languages. $ is nearly universal (Perl, Tcl, Ruby, shell, etc.)
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Next message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]