Use for/else instead of setting 'ok' variable.

This is more efficient, and this use case is exactly what the else clause
is for.
This commit is contained in:
Sybren A. Stüvel 2017-06-19 15:25:58 +02:00
parent 9af3119c53
commit c9291ab2ac
1 changed files with 2 additions and 3 deletions

View File

@ -211,11 +211,10 @@ def load_modules():
[(os.sep + f + ".py") for f in BLACKLIST])
for f in source_files:
ok = False
for ignore in ignore_paths:
if ignore in f:
ok = True
if not ok:
break
else:
raise Exception("Source file %r not loaded in test" % f)
print("loaded %d modules" % len(loaded_files))