Re: python strings

Tim Peters (tim@ksr.com)
Thu, 21 Apr 94 00:44:56 -0400

> ...
> This is much better:
>
> n = 2
> language = 'python'
>
> """The {n} numbers of {language} objects is usually easy to read in
> long strings because you can see which variable gets substituted in
> a given point."""
>
> Where inside of a long string, """ TX1 {expr} TX2 """ is equivalant
> to """ TX1 """ + `expr` + """ TX2 """

Think
str(expr)
would be wanted more often than
`expr` == repr(expr)

But not always. And this is another reason I'd like to keep variable
interpolation _out_ of the base language, but instead add hooks
sufficient to allow it to be implemented in user-level Python. Everyone
who enters this thread wants it done in a different way, and will think
of more useful variations the day after a feeble compromise is
released (if that happens at all ...). This is good! It's bad only if
we can't implement our latest grand schemes ourselves.

Others will doubtless point out that there are good uses for allowing
dicts other than the namespace dicts to define the substitutions, too. I
agree that the namespace dicts would be the ones most _often_ used,
though.

the-rub-there-is-that-you-can't-get-at-them-today-without-a-lot-of-
pain-ly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp