[Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

Barry Warsaw barry at python.org
Wed Dec 6 14:02:06 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 6, 2006, at 5:02 AM, Ka-Ping Yee wrote:

I agree with where Ka-Ping is headed...

> Where does this design constraint take us?
>
> One possibility it suggests is that the interpolation function could
> be generic, allowing the formatting template to be of a custom type
> that supports application-specific quoting.  If we go this route,
> that would argue in favour of solutions like a method on the
> template object or an infix operator, and would reject solutions
> like a built-in interpolated string type.

I agree that it makes less sense to build string interpolation into  
the language and more sense to add it to the library somehow (as  
we've already done for $-strings).  Based on that experience, I think  
it would be possible to build the application-specific quoting  
machinery into the thing supplying the interpolation values rather  
than the thing providing the template.  You need both sides of the  
equation.  IME, the template is the generic "machinery, not policy"  
part and the substitution supplier is the "policy" part.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRXa/TnEjvBPtnXfVAQJK/QP9EKGZK6DeZs/Yb/xo03/hL/P3G44JJJix
Y4VwP2EffmnNH1P8GqnC/YWsY2VGCWTmbqoOBy8waim5A4LS3PVCY4NikEdVb0rZ
KXdBL/b1mFvgHUfasxpAv2Cm7VOwH79YSW+wAI+1j4idOq0LrWg9cKijiOT0ey7j
5AjSHbV2h5I=
=0psW
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list