Draft PEP: string interpolation with backquotes

Roman Suzi rnd at onego.ru
Sun Dec 2 14:01:04 EST 2001

On Sun, 2 Dec 2001, Roman Suzi wrote:

>On Sun, 2 Dec 2001, Oren Tirosh wrote:
>>Title: String interpolation with backquotes
>>Author: oren at hishome.net (Oren Tirosh)
>>Created: 2-Dec-2001

>If we are concerned about readability, we do not need interpolation. Those
>who want it could easily use special library.

>Also i" has an impact on program efficiency, because ` ` will not
>be precompileble (or will it?) as the rest of Python code.

Ooops! PEP has words about preprocesing and compile-time
checks of i""-string. My mistake.


However, I think that Python doesn't need string interpolation!
My hope is, that Guido will never allow preprocessing and such
features in. Why formatting is not enough???

One can do:

print format("lalalal %(s1+s2+s3)s .... dfdfdfdf", namespace)

easily. Or, if one prefer, this kind of formats could be added:

print format("lalalal %(`s1+s2+s3`)s .... dfdfdfdf", namespace)

or just:

print format("lalalal %`s1+s2+s3`s .... dfdfdfdf", namespace)

In the form it is proposed, it makes difficult to control
presentation. Format string is more powerful than repr
could be made.

And anyway what inline `expr` will add?

Well, if this is to be done in Python, I'd prefer another way.
General kind of inlines, with possibility to process them
as one likes, with whatever processor is choosen.
But this is already possible and needs no additions.

Sincerely yours, Roman Suzi
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, December 02, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Old MacDonald had a computer with an EIE I/O" _/

More information about the Python-list mailing list