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 2016-03-20 20:54:26 +01:00
parent d46cd5d956
commit 195e50b93b
2 changed files with 1 additions and 5 deletions

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):

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