[Python-Dev] PEP 215 redux: toward a simplified consensus? (original) (raw)

Fredrik Lundh fredrik@pythonware.com
Mon, 25 Feb 2002 21:44:13 +0100


paul wrote:

Your strategy requires the naive user to learn a) the $ syntax, b) the magic operator syntax and c) the meaning of the locals() function. Plus you've thrown away the idea that interpolation works as it does in the shell or in Perl/Awk/Ruby etc.

At that point, in my mind, we're back where we started and should just use %.

# interpolate!
s = I('Joe has $ ', a, ' in his pocket.')

or perhaps

# print-like interpolation
s = P('Joe has $', a, 'in his pocket.')

works pretty well too. in all versions of python, with all existing syntax-aware tools. and if written in C, it's probably as fast as any other solution...

(implementing I/P is left as an exercise etc etc)