On 13.02.13 15:17, Daniel Holth wrote:
On Wed, Feb 13, 2013 at 7:10 AM, Serhiy Storchaka <storch...@gmail.com
<mailto:storch...@gmail.com>> 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)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com