string interpolation for python

mwilson at the-wire.com mwilson at the-wire.com
Mon Apr 2 11:34:09 EDT 2012


mwilson at the-wire.com wrote:

> Yingjie Lan wrote:
>> Seems you miss understood my notion of dynamic string.
>> Dynamic strings are expressions in disguise: the things
>> in between $...$ are plain old expressions (with optional
>> formatting specifications). They are evaluated
>> as if they were outside the dynamic string.
>  In that case you should re-think the delimiters, so that you have
>  something
> that can be nested.  An example (example only, I'm not in love with it as
> a final form):
> 
> "A string that gets %(count*spacer%) in the middle"
> 
> "A string that gets %(count*%(spacer%)%) in the middle"

A less than great example, I guess.  Maybe

> "A string that gets %(count*"-%(spacer%)-"%) in the middle"


	Mel.



More information about the Python-list mailing list