[Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl
barry at python.org
Wed Dec 6 14:02:06 CET 2006
-----BEGIN PGP SIGNED MESSAGE-----
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
-----END PGP SIGNATURE-----
More information about the Python-3000