cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-142518: Document thread-safety guarantees of list operations

Open lysnikolaou opened this issue 2 weeks ago • 4 comments

I'm opening this to start a discussion on what we want the structure of such documentation to be, as well as how to balance detail with succinctness. Feedback very welcome!

  • Issue: gh-142518

📚 Documentation preview 📚: https://cpython-previews--142519.org.readthedocs.build/en/142519/library/stdtypes.html#lists

lysnikolaou avatar Dec 10 '25 15:12 lysnikolaou

Merged main to fix CI

emmatyping avatar Dec 10 '25 17:12 emmatyping

I think any note about the atomicity of list operations should probably go after the documentation about the type. I can imagine a beginner to Python going to the documentation to read about lists and being confused about what free-threading semantics are talking about.

I also wonder if this should not be a note. Perhaps it would be better to describe as part of the type description what operations are atomic and which are not?

emmatyping avatar Dec 10 '25 17:12 emmatyping

My general opinion: reference documentation needs to be precise first; complete second. Succinctness comes after that.

Edit: Also, IMO, it's fine to add information first, then reorganize when a better structure becomes more obvious.

encukou avatar Dec 11 '25 10:12 encukou

I've addressed most of the feedback and added a lot more details.

I also inadvertently force-pushed. Sorry about that.

lysnikolaou avatar Dec 11 '25 13:12 lysnikolaou