On Mon, 14 Jan 2002, Paul Prescod wrote:
particularly whether the syntax was acceptable, or if a 'magic string' solution was still preferred.
IMHO, string interpolation should be one of the easiest things in the language. It should be something you learn in the first half of your first day learning Python. Any extra level of logical indirection seems misplaced to me.
Do you have any comments or suggestions about a substitution syntax, Paul? I think anything except PEP 216's magic initial u" for strings is able to be done with an object extension rather than a syntax change, including the substitution syntax within the magic string. I kept '%' rather than '$' because I assumed that particular char choice was a rather arbitrary part of the design patterned after Tcl or Perl, and that by keeping '%' I could do it with a dict. If a different syntax is desired, then it can be done by extending string to a magic format string object (rather than a magic string syntax). I'm not sure what you mean by logical indirection here: is that a comment on the syntax, or do you object to the idea of not implementing substitution by a language syntax change. ( But if what you mean is you want fewer chars for a double substition, that's something that can be fixed.) One reason I would prefer a "magic object" implementation, rather than a 'magic syntax' one is that, after playing around with this for a bit, I can see that there are a lot of possibilities for various substitution and template languages. A language syntax change, once accepted is cast in stone (and a new revised proposal is much less likely to be considered) while we can muck about and experiment with object extensions both before and after the get put into the standard lib. -- Steve Majewski