Skip to content

IDLE - Remove unneeded .keys for dict iteration #103737

Closed

Description

@terryjreedy

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

Activity

  1. self-assigned this
    on Apr 24, 2023
  2. added 2 commits that reference this issue on Oct 17, 2023
  3. added 3 commits that reference this issue on Oct 18, 2023
  4. added 2 commits that reference this issue on Oct 18, 2023
  5. added a commit that references this issue on Feb 11, 2024
  6. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions