Code without an explanatory tuple may bite you if your variable contains a tuple.
>>> nums = (1, 2, 3, 4) >>> print "debug: %r" % (nums, ) debug: (1, 2, 3, 4) >>> print "debug: %r" % nums Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: not all arguments converted during string formatting
Therefore, always using a tuple in the format string syntax is part of the security coding.
source share