String joining design - Core Development - Discussions on Python.org
Jan 3, 2023 ... join() on a string literal. I remember ages ago when we were debating how to add a string join function, there were arguments to making it ...
Jan 3, 2023 ... join() on a string literal. I remember ages ago when we were debating how to add a string join function, there were arguments to making it ...
However, I noticed something strange when testing these two methods. Simply summing the strings is faster but only if summing just two strings if I want to concatenate three strings, it is faster to use the join method.
Jan 23, 2020 ... Compile-time literal string concatenation was my original approach. The impetus for using str.join was to avoid having to add \n (or forgetting ...
Mar 23, 2023 ... The join method inserts the string w between ... string and treat these particular characters as Python code instead of literal characters.
The `join()` method of string objects concatenates strings with the string whose method is being called as the separator.You can use _double_ quotation marks if you prefer: Python doesn’t care which you use. ``` #
Mar 16, 2022 ... I'll explain the problems line by line in the original code, and in ... To do this, you can call the .join() method of strings with the ...
Apr 30, 2025 ... This is not a new pattern: it is exactly str.join() , but taking a sequence of Templates or strings and returning a Template. It comes over and ...
We even had join in the string module that took this syntax, but that went away with Python 3. On the consistency front, it’s also fun that str.join takes an iterable, but os.path.join uses unpacking so it doesn’t.
Jan 2, 2024 ... If you only need to replace a few unique strings, you could also use a regex, but that would generally be about 2x as slow, and the code would ...
Jan 27, 2020 ... But that could have been detected by checking if the __add__ of start equals the __add__ method of str. Like (pseudo code) def sum(… I was ...