#28893: Narrow dict.items() calls to .keys()/.items()
--------------------------------------+------------------------------------
     Reporter:  Дилян Палаузов        |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Core (Other)          |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  1
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Sergey Fedoseev):

 Replying to [comment:3 Дилян Палаузов]:
 > I know that iterating over a {{{dict:}}} and {{{dict.keys():}}} is
 effectively the same, but while the later returns (an iterator of) a view,
 I don't know what the former returns and therefore whether both forms are
 really equivalent.

 {{{
 In [2]: iter({})
 Out[2]: <dict_keyiterator at 0x7fd09e6d3598>

 In [3]: iter({}.keys())
 Out[3]: <dict_keyiterator at 0x7fd09e6d3728>
 }}}

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.29c518ef5c92c228c0e7f70ae041e491%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to