python: Better iterate over dictionaries
In Python 2, dictionaries have 2 sets of methods to iterate over their keys and values: keys()/values()/items() and iterkeys()/itervalues()/iteritems(). The former return lists while the latter return iterators. Python 3 dropped the method which return lists, and renamed the methods returning iterators to keys()/values()/items(). Using those names makes the scripts compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
committed by
Dylan Baker
parent
fdf946ffbf
commit
5530cb1296
@@ -504,7 +504,7 @@ def get_entrypoints(doc, entrypoints_to_defines, start_index):
|
||||
assert e.core_version is None
|
||||
e.extensions.append(ext)
|
||||
|
||||
return [e for e in entrypoints.itervalues() if e.enabled]
|
||||
return [e for e in entrypoints.values() if e.enabled]
|
||||
|
||||
|
||||
def get_entrypoints_defines(doc):
|
||||
|
||||
Reference in New Issue
Block a user