En Mon, 01 Oct 2007 19:10:11 -0300, James Stroud <[EMAIL PROTECTED]>
escribi�:
> Bruno Desthuilliers wrote:
>> First point is that Python has no "variable interpolation".
>
> If you squint, it kind of does*:
>
> >>> print '%(language)s has %(#)03d quote types.' % \
> {'language': "Python", "#": 2}
> Python has 002 quote types.
>
> You might think if the dict as a name space and the formatting operation
> as performing interpolation--but this take on formatting might be a
> stretch.
Stretching more:
py> language="Python"
py> number=4
py> print '%(language)s has %(number)d quote types.' % locals()
Python has 4 quote types.
Or even more:
py> from string import Template
py> print Template('$language has $number quote
types.').substitute(locals())
Python has 4 quote types.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list