GeezerVison is showing github.com — gh-124397: Add pure Python implementation of `threading.iter_locked` by eendebakpt · Pull Request #138261 · python/cpython
Conversation
eendebakpt
commented
Aug 30, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
picnixz
commented
Aug 30, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I would have really preferred something like threading.iterate to mimick the way we name things, e.g., enumerate[this], iter[over that], filter[this], map[it], etc (all of them are verbs), but I see why it's named iter_locked to mimick iter, though it looks like a variable name to me rather than a function name. My rationale for not having locked inside the name is that it belongs to the threading module, and thus semantically should be used by something that is threading-related, but this is probably too many guesses
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
picnixz
changed the title
gh-124397: Add threading.iter_locked
gh-124397: Add pure Python implementation of threading.iter_locked
Aug 30, 2025
|
I'm still not a huge fan of putting this in threading. threading should be for synchronization primitives, but this is a utility.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Just an idea: what about using the builtin iter with a new keyword locked? For locked=False we have the normal behavior, for True we use the iter_locked defined here.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I like that idea, but it would require a lot more work to accomplish. Changes to builtins require PEPs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
#148894 is a more complete implementation, closing this PR
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
#148894 is a more complete implementation, closing this PR
You didn't close the PR. I suppose that it was a mistake, so I close the PR.
|
eendebakpt reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|