-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-142518: Document thread-safety guarantees of list operations #142519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1858ef5 to
fd400f0
Compare
|
Merged main to fix CI |
|
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? |
| lst.append(item) # atomically appends item | ||
| lst.pop() # atomically removes and returns last item | ||
| lst[i] = value # atomically replaces item at index i | ||
| item = lst[i] # atomically retrieves item at index i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less horizontal scrolling on mobile:
| lst.append(item) # atomically appends item | |
| lst.pop() # atomically removes and returns last item | |
| lst[i] = value # atomically replaces item at index i | |
| item = lst[i] # atomically retrieves item at index i | |
| lst.append(item) # atomically appends item | |
| lst.pop() # atomically removes and returns last item | |
| lst[i] = value # atomically replaces item at index i | |
| item = lst[i] # atomically retrieves item at index i |
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!
📚 Documentation preview 📚: https://cpython-previews--142519.org.readthedocs.build/en/142519/library/stdtypes.html#lists