[Python-Dev] Utopian String Interpolation

M.-A. Lemburg mal@lemburg.com
Wed, 16 Jan 2002 19:22:37 +0100


Paul Prescod wrote:
> 
> I think that if we're going to do string interpolation we might as go
> all of the way and have one unified string interpolation model.
> 
>  1. There should be no string-prefix. Instead the string \$ should be
> magical in all non-raw literal strings as \x, \n etc. are. (if you want
> to do string interpolation on a raw string, you could do it using the
> method version below)
> 
> >>> from __future__ import string_interp
> 
> >>> a = "acos(.5) = \$(acos(.5))"
> 
> Embrace the __future__!

-1. 

Too dangerous. If string interpolation makes it into the core,
then please use a *new* construct. '\$' is currently interpreted
as '\$' and this should not be changed (heck, just think what would
happen to all the shell script snippets encoded in Python strings).
 
BTW, why don't you wrap all this interpolation stuff into
a module and then call a function to have it apply all the
magic you want. If I remember correctly, someone
else has already written such a module for Python.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/