[Python-Dev] Re: PEP 292, Simpler String Substitutions
Raymond Hettinger
python@rcn.com
Fri, 21 Jun 2002 11:59:05 -0400
> [Guido, quotes Christian]
> >> The following statements are ordered by increasing hate.
> >> 1 - I do hate the idea of introducing a "$" sign at all.
> >> 2 - giving "$" special meaning in strings via a module
> >> 3 - doing it as a builtin function
> >> 4 - allowing it to address local/global variables
>
> [and adds]
> > Doesn't 4 contradict your +1 on allvars()?
>
[Tim]
> Since Christian's reply only increased the apparent contradiction, allow
me
> to channel: they are ordered by increasing hate, but starting at the
> bottom. s/increasing/decreasing/ in his original, or s/hate/love/, and
you
> can continue to read it in the top-down Dutch way <wink>.
template = [
'$linenum - I do $feeling the idea of introducing the "$$" sign at all.',
'$linenum - give "$$" special meaning in strings via a module',
'$linenum - doing it as a builtin function'
'$linenum - allowing it to address/global local variables'
]
feeling = 'hate'
if 'Dutch' in options:
feeling = 'love'
template = template[::-1] # cool new feature
print 'The following statements are ordered by increasing $feeling.'.sub()
for cnt, line in enumerate(template): # cool new feature
linenum = cnt+1 # still wish enumerate had an optional start arg
print linenum.sub() # aspiring cool new feature
'regnitteh dnomyar'[::-1]