Pylint: use list comprehension instead of iteration

Iteration over indexes without calling enumeration fuction is not pythonic and should not be used.
In this case iteration can be replaced by list comprehension.  Fixing this allows to enable
pylint consider-using-enumerate check.

Reviewed-By: Petr Spacek <pspacek@redhat.com>
Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
This commit is contained in:
Martin Basti committed 2016-03-22 10:20:51 +01:00
1 parent d46cd5d956
commit 195e50b93b
2 files changed
+1 -5

No files matched your search

+1 -4
View File
@@ -784,11 +784,8 @@ class DomainValidator(object):
return info
def string_to_array(what):
blob = [0] * len(what)
return [ord(v) for v in what]
for i in range(len(what)):
blob[i] = ord(what[i])
return blob
class TrustDomainInstance(object):
-1
View File
@@ -72,7 +72,6 @@ disable=
not-an-iterable,
singleton-comparison,
misplaced-comparison-constant,
consider-using-enumerate,
unneeded-not,
not-a-mapping,
singleton-comparison