Skip to content

Commit e836b22

Browse files
committed
String concatenation optimizations: Update title
* Modifies the previously misleading title to be more precise. Related to satwikkansal#38
1 parent 17a456a commit e836b22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def convert_list_to_string(l, iters):
455455
456456
---
457457
458-
### String concatenation interpreter optimizations.
458+
### String interning
459459
460460
```py
461461
>>> a = "some_string"
@@ -473,7 +473,7 @@ def convert_list_to_string(l, iters):
473473
474474
#### 💡 Explanation:
475475
+ `+=` is faster than `+` for concatenating more than two strings because the first string (example, `s1` for `s1 += s2 + s3`) is not destroyed while calculating the complete string.
476-
+ Both the strings refer to the same object because of CPython optimization hat tries to use existing immutable objects in some cases (implementation specific) rather than creating a new object every time. You can read more about this [here](https://stackoverflow.com/questions/24245324/about-the-changing-id-of-an-immutable-string)
476+
+ Both the strings refer to the same object because of CPython optimization that tries to use existing immutable objects in some cases (implementation specific) rather than creating a new object every time. You can read more about this [here](https://stackoverflow.com/questions/24245324/about-the-changing-id-of-an-immutable-string).
477477
478478
---
479479

0 commit comments

Comments
 (0)