[Python-Dev] Re: PEP 292, Simpler String Substitutions

Christian Tismer tismer@tismer.com
Thu, 20 Jun 2002 20:28:43 +0200


Guido van Rossum wrote:
> Christian,
> 
> you seem to be contradicting yourself.  First:
> 
> [someone]
> 
>>>+1 on the allvars() suggestion also.
>>
> 
> [Christian]
> 
>>me too.
> 
> 
> and later:
> 
> [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
> 
> 
> Doesn't 4 contradict your +1 on allvars()?

By no means.
allvars() is something like locals() or globals(), just
an explicit way to produce a dictionary of variables.

What I want to preserve is the distinction between
arbitrary "%(name)s" or maybe "${name}" names and
my local variables.
Using locals() or allvars(), I can decide to *feed*
the formatting expression with variable names.
But the implementation of .sub() should not know
anything about variables, the same way as % doesn't know
about variables.
Formatting is "by value", IMHO.

Furthermore I'd like to thank Alex for his opinions,
additions and adjustments to my post. I have to say that
I always *am* emotional with such stuff, although I'm
trying hard not to. But he hits the nail's head more than I.

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/