Imagine you have four strings: a, b, c and d.

Say you want their concatenation, e = a + b + c + d. However, the + operator is only defined for two operands, so you would apparently need to concatenate the individual strings one by one.

The naive way to calculate this might be the following:

e = ((a + b) + c) + d

But this is inefficient, because it generates two throwaway strings: a + b and a + b + c.

Now, imagine we created a buffer-like object holding all the characters we wanted to combine:

e_buffer = [a, b, c, d]

We could create e from this all at once, avoiding the need to create many intermediate strings.

This requires a function, which, in Python, we call join; it is a method of a str, and intersperses that string between the arguments provided. Therefore, when you execute some_separator.join([a, b, c]), you get, in effect, a + some_separator + b + some_separator + c.

To answer your question: in general, when concatenating many strings, it should be faster to use join, and it will at least be more readable, especially when using a separator. For the case given in the question, I would instead use an f-string:

def greeting(name: str) -> str:
    return f'Hello {name}'
Answer from gmds on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_string_join.asp
Python String join() Method
Remove List Duplicates Reverse ... Study Plan Python Interview Q&A Python Training ... The join() method takes all items in an iterable and joins them into one string....
🌐
LabEx
labex.io › tutorials › python-how-to-use-join-method-in-strings-434470
How to use join method in strings | LabEx
The join() method is a powerful string manipulation technique in Python that allows you to concatenate elements of an iterable (such as a list, tuple, or set) into a single string.
Discussions

cpython - How use ' '.join() in Python? - Stack Overflow
We could create e from this all at once, avoiding the need to create many intermediate strings. This requires a function, which, in Python, we call join; it is a method of a str, and intersperses that string between the arguments provided. More on stackoverflow.com
🌐 stackoverflow.com
Python .join or string concatenation - Stack Overflow
I realise that if you have an iterable you should always use .join(iterable) instead of for x in y: str += x. But if there's only a fixed number of variables that aren't already in an iterable, is ... More on stackoverflow.com
🌐 stackoverflow.com
Why is .join() the way it is?
Wouldn't it make more sense to have the join be a member function of the list/iterable? No, no., a thousand times, no! Joining a list makes no sense whatsoever unless it’s a one-dimensional homogenous list containing only str objects. Can you think of any other method on lists (or any other heterogenous container type) that can only work when all members are of a specific type, and that must return that same type? No, you can’t, and that’s because joining around a delimiter string is fundamentally a special case of wanting to intersperse the delimiter string it_self_ between all the members of an iterable. I could see adding a builtin to do this, but it would effectively just be an alias for str.join, and the Zen principles that that “there should be only one way to do something” and “special cases are not special enough to break the rules” would argue against adding it. def intersperse(strings, delimiter): return delimiter.join(strings) More on reddit.com
🌐 r/Python
60
127
March 9, 2022
join() or '+' for string concatenation
join if you already have an iterable of strings. fstrings if you are trying to format some variables. f'{a} {b}' + if you're being lazy or really just need a + b with no other formatting. is this a blanket statement to avoid using += and + for concatenation in all cases? If so, why even have the feature as part of the language? Literally doesn't matter. If you are building a string go nuts with +=. It's not something you'd be farting around with if that level of optimization actually mattered. More on reddit.com
🌐 r/learnpython
4
1
August 27, 2022
People also ask

If a dictionary has integer type keys and string type values, can we concatenate the values using the join() function?
Yes, we need to just put values as the iterable to achieve this. Here's how that can be done: dictionaryEx = {1:'One',2:'Two', 3: 'Three'} separatorThen =' then ' print(separatorThen.join(dictionaryEx.values())) Output: One then Two then Three
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › join function in python
Join Function in Python | Interview Kickstart
If a dictionary has integer type keys and string type values, what happens if we attempt concatenating the keys using the join() function?
We can't concatenate keys of integer type using the join function. If we try to do that, we'll get a TypeError, as can be seen here: dictionaryEx = {1:'One',2:'Two', 3: 'Three'} separatorThen =' then ' print(separatorThen.join(dictionaryEx)) Output: stderr Traceback (most recent call last): File "./file_name.py", line 3, in TypeError: sequence item 0: expected str instance, int found
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › join function in python
Join Function in Python | Interview Kickstart
🌐
Mimo
mimo.org › glossary › python › string-join-method
Python's String Join Method: Efficient String Concatenation
The Python String join() method joins elements of a list, string, or tuple into a single string, separated by a string.
Find elsewhere
🌐
YouTube
youtube.com › coding with kids
How to Code PYTHON: *String Split and Join* - YouTube
Let's get started! 🔥🔥🔥 In this video, we will write few PYTHON 🐍 scripts to demonstrate how to split a string based on a delimiter and join a list of str...
Published: March 25, 2021
Views: 157
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string-join-method
Python String join() Method - GeeksforGeeks
join() method in Python is used to combine elements of an iterable into a single string. It places the specified separator between each element.
Published: October 1, 2026
🌐
Interview Kickstart
interviewkickstart.com › home › blogs › learn › join function in python
Join Function in Python | Interview Kickstart
September 25, 2025 - The string method join() is a built-in function in Python that provides flexibility in creating and concatenating strings in Python from an iterable.
🌐
Reddit
reddit.com › r/python › why is .join() the way it is?
r/Python on Reddit: Why is .join() the way it is?
March 9, 2022 -

<rant>

I've been programming in Python for almost a decade now and I love most things about it. One thing that never felt right to me was how a string's .join() method works. In short, ' + '.join(['a', 'b', 'c']) returns 'a + b + c'.

Wouldn't it make more sense to have the join be a member function of the list/iterable? You could apply the same type constraints. I'd even be comfortable with it floating alone in the namespace and calling something like join(['a', 'b', 'c'], ' + ').

In short, the current way feels backwards in some way that I can't explain an it's grinding my gears rn. Carry on.

</rant>

🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › str › join.html
join — Python Reference (The Right Way) 0.1 documentation
The separator between elements is the string providing this method. >>> ''.join(['A', 'B', 'C']) 'ABC' >>> ''.join({'A': 0, 'B': 0, 'C': 0}) # note that dicts are unordered 'ACB' >>> '-'.join(['A', 'B', 'C']) # '-' string is the seprator 'A-B-C'
🌐
iO Flood
ioflood.com › blog › python-join
Python join() Function | Usage Guide (With Examples)
February 14, 2024 - In this example, we have a list named ‘words’ containing two strings: ‘Hello’ and ‘World’. We use the join() function with a space (‘ ‘) as the separator to join these strings together into a single string ‘Hello World’. This is the basic usage of Python’s join() function.
🌐
Reddit
reddit.com › r/learnpython › join() or '+' for string concatenation
r/learnpython on Reddit: join() or '+' for string concatenation
August 27, 2022 -

I know there are several ways to concatenate strings. For the most basic cases, such as joining a and b here..

a = "ABCD"
b = "EFGH"

.. which is recommended?

a + b

''.join([a, b])

I find many examples of people using join(), but I don't see how this is an advantage in the simplest of cases. One disadvantage is it consumes 10 additional characters on the line of code, which is significant if you're trying to keep lines at 79 characters or less.

As a follow-up question, can anyone elaborate on this statement from PEP8 ?

...do not rely on CPython’s efficient implementation of in-place string concatenation for statements in the form a += b or a = a + b. This optimization is fragile even in CPython (it only works for some types) and isn’t present at all in implementations that don’t use refcounting.

.. is this a blanket statement to avoid using += and + for concatenation in all cases? If so, why even have the feature as part of the language?

🌐
Python.org
discuss.python.org › ideas
Additional argument for str.join() - Ideas - Discussions on Python.org
February 21, 2021 - I’ suggesting an additional argument for str.join() so that ', '.join(['a', 'b', 'c'], ', or ') would output 'a, b, or c' (sorry, I had an additional ‘,’ in my post at https://bugs.python.org/issue43280 that was gramm…
🌐
Hyperskill
hyperskill.org › university › python › join-method-in-python
Python join() Method: Join Strings from a List (with Examples)
June 5, 2026 - The join() function in Python is used to merge items from a collection, such as a list or tuple, into a single string. It takes a separator and combines the elements of the collection with that separator in between.
🌐
YouTube
youtube.com › john hammond
Python 57 String Join - YouTube
If you would like to support me, please like, comment & subscribe, and check me out on Patreon: https://patreon.com/johnhammond010E-mail: johnhammond010@gmai...
Published: March 4, 2012
Views: 578
🌐
Python.org
discuss.python.org › python help
Quick question on .join() - Python Help - Discussions on Python.org
March 31, 2022 - Hello all, I’m just learning and I’ve learned about the Join() method and been using it for a chapter or two. Every time my book lists ‘’.join() where the ‘’ are two apostrophe’s and not a quotation mark. I can’t find anything online showing or mentioning why the ‘’. is ...
🌐
Medium
allwin-raju.medium.com › mastering-pythons-join-method-0ac455236f7f
Mastering Python’s join() Method
February 11, 2025 - Read for free: https://allwin-...79a6a541988d6b1ea5decb47ea90 · The join() method takes an iterable (like a list or tuple) and joins its elements into a string, using the specified separator....
🌐
iO Flood
ioflood.com › blog › python-join-list-to-string
Python Join List to String: Step-by-Step Guide
June 18, 2024 - So, let’s dive in and start mastering Python’s join() function! To join a list to a string in Python, you use the join() function like string = ' '.join(list).
🌐
Cspsprotocol
cspsprotocol.com › home › blog › python string join() function
How to use String Join() function in Python? - Cspsprotocol
July 25, 2023 - The join() function works over an iterable object such as a tuple, list, etc. An iterable object may have multiple elements of similar or different types. The join() function takes an iterable object as an argument, concatenates all sequence elements, and returns it as a string.
🌐
Real Python
realpython.com › python-join-string
How to Join Strings in Python – Real Python
October 22, 2025 - You call .join() on the separator, passing the iterable of strings to join. By the end of this tutorial, you’ll understand that: You use .join() in Python to combine string elements with a specified separator.