Toy interpolation code [was Re: Draft PEP: string interpolation with backquotes]

Oren Tirosh oren-py-l at hishome.net
Thu Dec 6 08:44:54 EST 2001


On Thu, Dec 06, 2001 at 04:59:05AM +0000, Nick Mathewson wrote:
> One thing I don't understand from the Interpolation Wars is why people
> feel Python needs any new syntax for this.  Here's some example code
> that shows how to implement four kinds of proposed interpolation.

First, I must say that I like your approach.  Code speaks much louder than 
words.

There are two reasons I can think of why anyone would feel that Python
needs new syntax for string interpolation:

1. One likes his syntactic sugar extra-sweet and feels than even an import
statement and an extra pair of parens is too bitter.

2. One likes all the expressions in his code syntax-checked at compile time 
and converted into bytecode without the use of runtime evaluation.

PEP 215 appears to be written with #1 in mind.  My PEP draft for string
interpolation is mostly concerned with #2.

If the BDFL ever decides to implement string interpolation he should have 
more than just one proposal to choose from.

	Oren






More information about the Python-list mailing list