Whatever happened to String Interpolation?

Oren Tirosh oren-py-l at hishome.net
Wed Dec 12 09:14:55 EST 2001


On Wed, Dec 12, 2001 at 09:25:24AM +0200, Ville Vainio wrote:
> 
> > That already exists: type 'python Itpl' in google.
> 
> So, it appears to be done already. What's the fuss, then? Wouldn't
> having this in the standard library suffice? Looking at the relatively
> concise syntax on Itpl, why on earth would one want an equivalent
> thing encumbering the core language?

Something that can be done in a module belongs in a module, not in the core 
language.  Saving an import statement and a pair of parentheses does not 
justify changes to the core language.

But the proposal in http://www.tothink.com/python/interpp cannot be
implemented in a module.  The embedded expressions are fully syntax-checked 
at compile time and generate real bytecode.  There is no use of eval() or 
runtime parsing that are so common in so-called 'scripting' languages and 
contribute to their slow performance and security problems.  I believe 
this is a worthy goal, and it can only be accomplished by extending the 
syntax of the language.

The issue of whether it SHOULD be added to the language is, of course, open
for debate but the only way it CAN be implemented is as part of the
language syntax.

	Oren




More information about the Python-list mailing list