Arnaud Delobelle
1/31/2008 10:46:00 PM
On Jan 31, 10:39 pm, Steven D'Aprano <st...@REMOVE-THIS-
cybersource.com.au> wrote:
> On Thu, 31 Jan 2008 20:05:44 +0000, Stargaming wrote:
> > String concatenation is generally considered unpythonic, better use
> > string interpolation::
>
> > 'H> %s' % (M,)
[...]
> Also, the tuple above is totally unnecessary. 'H> %s' % M will work fine.
...except if M is a tuple:
>>> M = 'spam', 'eggs'
>>> 'H> %s' % (M,)
"H> ('spam', 'eggs')"
>>> 'H> %s' % M
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting
Pedantically yours,
--
Arnaud