Skip to content

Commit 4710dd6

Browse files
authored
Update README.md
1 parent 3c86749 commit 4710dd6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Inspired from the amazing [C#'s concurrent collections](https://learn.microsoft.
1717

1818
**_There is a lot of confusion on whether Python collections are thread-safe or not_**<sup>1, 2, 3</sup>.
1919

20-
The bottom line is that Python's built-in collections are **not fully thread-safe** for all operations. While some simple operations (like `list.append()` or `dict[key] = value`) are thread-safe due to the Global Interpreter Lock (GIL), **compound operations and iteration with mutation are not**. This can lead to subtle bugs, race conditions, or even crashes in multi-threaded programs.
20+
The bottom line is that Python's built-in collections are **not fully thread-safe** for all operations.
21+
While some simple operations (like `list.append()` or `dict[key] = value`) are thread-safe due to the Global Interpreter Lock (GIL), **compound operations and iteration with mutation are not**. This can lead to subtle bugs, race conditions, or even crashes in multi-threaded programs.
2122

2223
See the [Python FAQ: "What kinds of global value mutation are thread-safe?"](https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe) for details. The FAQ explains that only some (if common) operations are guaranteed to be atomic and thread-safe, but for anything more complex, you must use your own locking.
2324
The docs even go as far as to say:
@@ -26,7 +27,9 @@ The docs even go as far as to say:
2627
2728
Which is telling.
2829

29-
`concurrent_collections` provides drop-in replacements that handle locking for you, making concurrent programming safer and easier.
30+
Even [Google recommends to not rely on atomicity of built-in collections](https://github.com/google/styleguide/blob/91d6e367e384b0d8aaaf7ce95029514fcdf38651/pyguide.md#218-threading).
31+
32+
This **`concurrent_collections`** library provides drop-in replacements that handle locking for you.
3033
Suggestions and feedbacks are welcome.
3134

3235
<sub>

0 commit comments

Comments
 (0)