Opened 7 years ago
Closed 7 years ago
#28249 closed Cleanup/optimization (fixed)
Remove unnecessary dict.keys() calls
Reported by: | Jon Dufresne | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
iter(dict)
is equivalent to iter(dict.keys())
. Can simply act on the dictionary. Provides simpler, more concise syntax and avoids the extra function call in Django.
Inspired by Lennart Regebro's PyCon 2017 presentation "Prehistoric Patterns in Python". Available at: https://www.youtube.com/watch?v=V5-JH23Vk0I
Note:
See TracTickets
for help on using tickets.
PR