Skip to content
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

IDLE - Remove unneeded .keys for dict iteration #103737

Closed
terryjreedy opened this issue Apr 24, 2023 · 0 comments
Closed

IDLE - Remove unneeded .keys for dict iteration #103737

terryjreedy opened this issue Apr 24, 2023 · 0 comments
Assignees

Comments

@terryjreedy
Copy link
Member

terryjreedy commented Apr 24, 2023

Issue #87179, item 6. At the moment, ob.keys() appears 16 times in idlelib. Sometimes 'ob' is a dict, in which case '.keys()' can be removed. Sometimes ob is not a dict, and possibly not an iterable, and '.keys()' returns an iterable other than a dict keys view. In some such cases I am adding a note as to what the return value is to be clear that '.keys()' is needed.

Sometimes func(somedict) (list or tuple or set or ?) is needed because an immediate iteration will modify the dict or the captured keys will be sent elsewhere, such as through the rpc connection, or the keys are transformed, as with sorted.

Linked PRs

@terryjreedy terryjreedy self-assigned this Apr 24, 2023
terryjreedy added a commit to terryjreedy/cpython that referenced this issue Oct 17, 2023
Comment some of non-dict .keys() returns.

config: remove .keys(), fix dump, add comments.
debugobj: remove one .keys()

test_config: remove .keys()
test_debugobj: comment .keys() returns
terryjreedy added a commit that referenced this issue Oct 18, 2023
Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 18, 2023
…ythonGH-110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
(cherry picked from commit baefbb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 18, 2023
…ythonGH-110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
(cherry picked from commit baefbb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 18, 2023
…ythonGH-110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
(cherry picked from commit baefbb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this issue Oct 18, 2023
…H-110960) (#111027)

gh-103737: IDLE - Remove unneeded .keys() for dict iteration (GH-110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
(cherry picked from commit baefbb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this issue Oct 18, 2023
…H-110960) (#111026)

gh-103737: IDLE - Remove unneeded .keys() for dict iteration (GH-110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
(cherry picked from commit baefbb2)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…ython#110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…ython#110960)

Add comments where .keys() is needed.
Leave debugger usages along because situation is unclear as indicated in expanded comment.
Most testing is manual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant