diff options
author | Mats Wichmann <mats@linux.com> | 2019-08-12 15:33:24 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-01-16 15:23:44 (GMT) |
commit | 407dda1715776a962119cbf8442286af7cae79b9 (patch) | |
tree | 83e0eb791012576a326b0e4e65ec86e714899d06 /src/engine/SCons/Node/FS.py | |
parent | 606ae2e0743cad8c4cf76a9d0d1f0cb1a83964fd (diff) | |
download | SCons-407dda1715776a962119cbf8442286af7cae79b9.zip SCons-407dda1715776a962119cbf8442286af7cae79b9.tar.gz SCons-407dda1715776a962119cbf8442286af7cae79b9.tar.bz2 |
Stop converting to list where not needed
Python 3 returns a special object, which is iterable, rather than
a list when you ask for dictionary keys(), values(), items(). if
you then proceed to iterate over it it's being used as expected and
doesn't have to be forced to a list first. This occurs a number of
places in this form:
for k in list(something.keys()):
Also there are several places where the code loops over the result
of dict.keys() and then uses the key to index into the dictionary,
this can be replaced by:
for k, v in something.items():
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index e1d6f68..6f16256 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1612,7 +1612,7 @@ class Dir(Base): This clears any cached information that is invalidated by changing the repository.""" - for node in list(self.entries.values()): + for node in self.entries.values(): if node != self.dir: if node != self and isinstance(node, Dir): node.__clearRepositoryCache(duplicate) @@ -1623,7 +1623,7 @@ class Dir(Base): except AttributeError: pass if duplicate is not None: - node.duplicate=duplicate + node.duplicate = duplicate def __resetDuplicate(self, node): if node != self: |