[Python-Dev] *Simpler* string substitutions

Barry A. Warsaw barry@zope.com
Sat, 22 Jun 2002 21:20:54 -0400


    GvR> Oren made a good point that Paul emphasized: the most common
    GvR> use case needs interpolation from the current namespace in a
    GvR> string literal, and expressions would be handy.  Oren also
    GvR> made the point that the necessary parsing could (should?) be
    GvR> done at compile time.

I'll point out that in my experience, while expressions are (very)
occasionally handy, you wouldn't necessarily need /arbitrary/
expressions.  Something as simple as allowing dotted names only would
solve probably 90% of uses, e.g.

    person = getPerson()
    print '${person.name} was born in ${person.country}'

Not that this can't execute arbitrary code of course, so the security
implications of that would need to be examined.

-Barry