[Bf-blender-cvs] [b72ba5c78d1] id_copy_refactor: Use for/else instead of setting 'ok' variable.

Sybren A. Stüvel noreply at git.blender.org
Tue Jun 20 17:56:41 CEST 2017


Commit: b72ba5c78d12b3c31205de2cb3e5dd0f9cca8168
Author: Sybren A. Stüvel
Date:   Mon Jun 19 15:25:58 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rBb72ba5c78d12b3c31205de2cb3e5dd0f9cca8168

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

This is more efficient, and this use case is exactly what the else clause
is for.

===================================================================

M	tests/python/bl_load_py_modules.py

===================================================================

diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py
index c13679d16f0..5908ba14718 100644
--- a/tests/python/bl_load_py_modules.py
+++ b/tests/python/bl_load_py_modules.py
@@ -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))




More information about the Bf-blender-cvs mailing list