On 13.02.13 15:17, Daniel Holth wrote:
On Wed, Feb 13, 2013 at 7:10 AM, Serhiy Storchaka <email@example.com mailto:firstname.lastname@example.org> wrote: I prefer "x = '%s%s%s%s' % (a, b, c, d)" when string's number is more than 3 and some of them are literal strings.
Fixed: x = ('%s' * len(abcd)) % abcd
No, you don't need this for the constant number of strings. Because almost certainly some of strings will be literals, you can write this in a more nice way. Compare:
'config[' + key + '] = ' + value + '\n' ''.join(['config[', key, '] = ', value, '\n']) 'config[%s] = %s\n' % (key, value)