Draft PEP: string interpolation with backquotes

Jeff Shannon jeff at ccvcorp.com
Wed Dec 5 20:11:25 CET 2001


Paul Svensson wrote:

> Oren Tirosh <oren-py-l at hishome.net> writes:
>
> >As for the issue of interpolation with backticks being equivalent to str()
> >rather than repr() - I believe most people won't even notice.  When the
> >system simply does the Right Thing according to the context it feels more
> >consistent even if technically it isn't.
>
> Actually,
> considering that quotes create strings,
> having `foo` mean repr(foo) and "`foo`" mean str(foo) seems fairly natural...

Having "`foo`" mean str(foo) and having "'foo'" meaning "'foo'" seems pretty
confusing to me.

Backticks are awkward, hard to find on the keyboard, and hard to visually
differentiate from regular single-quotes.  I strongly dislike using them.

Then again, I never *would* use them, even if this proposal passes, because it
seems *much* clearer to me to use "%s" % foo

And the thought of reading through a string with 50 or more embedded expressions,
exactly the situation that this proposal is being recommended for, and trying to
keep straight what's text and what's code, gives me the willies.

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list