Skip to content

Simplify dict iterations from Python 2 to 3 migration#2331

Merged
Avasam merged 8 commits intomhammond:mainfrom
Avasam:simplify-dict-iterations-from-Python-2-to-3-migration
Oct 13, 2024
Merged

Simplify dict iterations from Python 2 to 3 migration#2331
Avasam merged 8 commits intomhammond:mainfrom
Avasam:simplify-dict-iterations-from-Python-2-to-3-migration

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Jul 26, 2024

  • Python 2 to 3 automatic migration tooling added a bunch of unneeded list calls when the dict_keys/dict_values/dict_items object is immediately iterated upon.
  • Similarly, removed redundant calls to iter on dict_keys/dict_values/dict_items
  • Iterate over values only when the keys aren't used
  • Iterate over keys only when the values aren't used
  • Chain iterable instead of generating and concatenating multiple lists (only for lines affected by above changes)
  • Use sets instead of dicts when the value isn't used (only for lines affected by above changes and only for non-public names)
  • Uses comprehensions when relevant (only for lines affected by above changes)

Equivalent adodbapi PR: #2332

@Avasam Avasam merged commit 9ec6542 into mhammond:main Oct 13, 2024
@Avasam Avasam deleted the simplify-dict-iterations-from-Python-2-to-3-migration branch October 13, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants