[Python-Dev] Usage of += on strings in loops in stdlib
MRAB
python at mrabarnett.plus.com
Wed Feb 13 18:33:05 CET 2013
More information about the Python-Dev mailing list
Wed Feb 13 18:33:05 CET 2013
- Previous message: [Python-Dev] Usage of += on strings in loops in stdlib
- Next message: [Python-Dev] Usage of += on strings in loops in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2013-02-13 13:23, Lennart Regebro wrote: > On Wed, Feb 13, 2013 at 1:10 PM, Serhiy Storchaka <storchaka at 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. > > This has the benefit of being slow both on CPython and PyPy. Although > using .format() is even slower. :-) > How about adding a class method for catenation: str.cat(a, b, c, d) str.cat([a, b, c, d]) # Equivalent to "".join([a, b, c, d]) Each argument could be a string or a list of strings.
- Previous message: [Python-Dev] Usage of += on strings in loops in stdlib
- Next message: [Python-Dev] Usage of += on strings in loops in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list