[blivet:master 5/9] Compress loop into generator list comprehension

mulhern amulhern at redhat.com
Wed Apr 23 21:49:29 UTC 2014


There should be no semantic change.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/storage_log.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/blivet/storage_log.py b/blivet/storage_log.py
index 2f430e9..0609d0b 100644
--- a/blivet/storage_log.py
+++ b/blivet/storage_log.py
@@ -67,7 +67,6 @@ def log_exception_info(log_func=log.debug, fmt_str=None, fmt_args=None):
         log_func(fmt_str, spaces, *fmt_args)
     log_func("%sBegin exception details.", spaces)
     tb = traceback.format_exception(*sys.exc_info())
-    for entry in tb:
-        for line in [l for l in entry.split("\n") if l]:
-            log_func("%s    %s", spaces, line.rstrip())
+    for line in (l.rstrip() for entry in tb for l in entry.split("\n") if l):
+        log_func("%s    %s", spaces, line)
     log_func("%sEnd exception details.", spaces)
-- 
1.8.3.1



More information about the anaconda-patches mailing list