Concatenating Strings

Andrew Farrell amfarrell at mit.edu
Thu Apr 9 14:44:11 EDT 2015


I am under the impression that using format() is the canonically "right way
to do it". It is certainly more readable than using ''.join() and is more
semantically specific than string addition.

On Thu, Apr 9, 2015 at 1:35 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Apr 10, 2015 at 4:29 AM, Travis Griggs <travisgriggs at gmail.com>
> wrote:
> >
> >     if k + ‘_@‘ in documents:
> >
> >     timeKey = k + ‘_@‘
> >
> >     historyKey = thingID + ‘_’ + k
> >
> > I’m curious where others lean stylistically with this kind of thing. I
> see *at least* 2 other alternatives:
> >
>
> So few? I'd just use string addition. No need to worry about
> performance unless you actually have reason to believe it's a problem.
> String addition exists for a reason!
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150409/1df5cdb9/attachment.html>


More information about the Python-list mailing list