[Django] #28249: Remove unnecessary dict.keys() calls

2 views
Skip to first unread message

Django

unread,
May 27, 2017, 6:17:24 PM5/27/17
to django-...@googlegroups.com
#28249: Remove unnecessary dict.keys() calls
------------------------------------------------+------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
`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

--
Ticket URL: <https://code.djangoproject.com/ticket/28249>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 27, 2017, 6:20:04 PM5/27/17
to django-...@googlegroups.com
#28249: Remove unnecessary dict.keys() calls
-------------------------------------+-------------------------------------

Reporter: Jon Dufresne | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jon Dufresne):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8563 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28249#comment:1>

Django

unread,
May 27, 2017, 7:08:57 PM5/27/17
to django-...@googlegroups.com
#28249: Remove unnecessary dict.keys() calls
-------------------------------------+-------------------------------------

Reporter: Jon Dufresne | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Uncategorized | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"21046e77734278cea871dce922220bf29aa5b7b4" 21046e7]:
{{{
#!CommitTicketReference repository=""
revision="21046e77734278cea871dce922220bf29aa5b7b4"
Fixed #28249 -- Removed unnecessary dict.keys() calls.

iter(dict) is equivalent to iter(dict.keys()).
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28249#comment:2>

Reply all
Reply to author
Forward
0 new messages