[Python-Dev] PEP 215 redux: toward a simplified consensus?

Paul Prescod paul@prescod.net
Mon, 25 Feb 2002 16:39:21 -0800


[meant to send this before]

Guido van Rossum wrote:
> 
>...
> 
> All right, but there *also* needs to be a way to invoke interpolation
> explicitly -- just like eval().  This has applicability e.g. in i18n.

Agree 100%. The last time we discussed this I proposed there should be a
function to do this. But the naive integrated syntax could be compile
time.

My complaints with the current interpolation are:

 1. they require too many magical incantations to invoke (especially %
vars())
 2. they require too much thinking about types and conversions in the
syntax
 3. special behaviour with dictionaries and tuples and singleton tuples
etc.
 4. operator abuse

I would only be in favour of a replacement if for *simple cases* it
cleared up all of these issues so that it is roughly as easy as in
Perl/Ruby/sh/tcl:

a = $"My name is $name"

If there is any more syntax than that then personally I think that the
cost/benefit ratio falls down. So I don't see this as a big win:

a = "My name is $name" \ locals()

It solves two of my four problems.

Maybe other people have different goals than I do and that's why they
see the above as a "win".

 Paul Prescod