✳flâneur — a map of the web's best reading
Python Gotcha: Join vs Concat · Ponderings of an Andy
andrewwegner.com · 643 words · saved by 1 readers
Append 100,000 strings together using join or concat - Which is faster?
Article Contents The Problem Results What's happening here? What are the implications of this? The Problem ¶ Here's a somewhat contrived example to demonstrate a problem. I need to create a string with the word word 100,000 times. What's the fastest way to generate this string? I could use string concatenation (simply + the strings to one another). I could join a list with 100,000 items. My proposed code for this example is below def concat_string ( word : str , iterations : int = 100000 ) -> str : final_string = "" for i in range ( iterations ) : final_string += word return final_string def j
Explore this link on the map →related reading
- Immutable object - Wikipediaen.wikipedia.org
- CRDTs go brrrjosephg.com
- Programming FAQ — Python 3.14.6 documentationdocs.python.org
- Speed mattersscattered-thoughts.net
- styleguide | Style guides for Google-originated open-source projectsgoogle.github.io
- What is the simplest way to swap each pair of adjoining chars in a string with Python? - Stack Overflowstackoverflow.com
- A practical introduction to functional programmingmaryrosecook.com
- Storing UTF-8 Encoded Text with Strings - The Rust Programming Languagedoc.rust-lang.org
- 3. An Informal Introduction to Python — Python 3.14.6 documentationdocs.python.org
- Rust Iterator Cheat Sheetdanielkeep.github.io
- An introduction to functional programmingcodewords.recurse.com
- Immutability in React: Should you mutate objects? - LogRocket Blogblog.logrocket.com