[Python-Dev] Re: *Simpler* string substitutions

Moore, Paul Paul.Moore@atosorigin.com
Fri, 21 Jun 2002 11:22:27 +0100

Some points on the current thread, in no particular order...

1. While I agree that "$" is better known as an interpolation
   character than "%", it shouldn't be forgotten that "%" is the
   interpolation character in DOS/Windows shells. Some recent
   examples which showed "%" used ("The sum of %x and %y is
   %(x+y)") looked entirely natural to me (I use Windows more
   than Unix) - in fact, more so than "$"!!

2. The internationalisation issue is clearly important. However,
   it has very different characteristics insofar as the template
   string is (of necessity) handled at runtime, so issues of
   compilation and security become relevant. I'm no I18N expert,
   so I can't comment on details, but I *do* think it's worth
   separating out the I18N issues from the "simple interpolation"

3. I feel that the existing % formatting operator cannot
   realistically be removed. Tidying up some of its warts may be
   possible, and even sensible, but there's too much code using
   it (and as was pointed out, template strings may not event be
   stored in code files) to make major changes.

4. Access to variables is also problematic. Without compile-time
   support, access to nested scopes is impossible (AIUI). But on
   the other hand, a scheme with subtle limitations such as lack
   of such access may not realistically count as "simple"...

5. (Personal opinion here!) I believe that formatting specifiers
   so not belong in a "simple" scheme - leave them for the
   "advanced" verion (the existing % operator). On the other hand,
   I feel that expression interpolation, within limits, *is*
   suitable. It's the user's responsibility not to go overboard,

Sorry for butting into an already long thread. I hope the summary
is useful, at least...