[New-bugs-announce] [issue13363] Many usages of dict.keys(), dict.values(), dict.items() when the iter version could be used

skreft report at bugs.python.org
Mon Nov 7 04:11:56 CET 2011


New submission from skreft <skreft at gmail.com>:

In Python 2.7, there are many patterns of the form

for x in mapping.(keys()|values()|items()):
    #code
when the iterator version of those method could be used.
Is there any reason for using those methods?

I see that in some other parts of the code the iterator version is used. Here is the summary:

       Non iter version Iter version
Keys   160              21 
Values 35               23
Items  249              79

I sued the following command

$ egrep -R "for.*[.]iterkeys\(\)" . | wc -l 


What's the position about this? Does it worth it to fix this?

----------
messages: 147199
nosy: skreft
priority: normal
severity: normal
status: open
title: Many usages of dict.keys(), dict.values(), dict.items() when the iter version could be used
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13363>
_______________________________________


More information about the New-bugs-announce mailing list