Thanks to visit codestin.com
Credit goes to github.com

Skip to content

IDLE - Remove unneeded .keys for dict iteration #103737

Closed
@terryjreedy

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

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions