[gimp] Use list comprehensions



commit 82e59a951dfbd960daabfdbe31c86c9ce1abedc5
Author: Michal <m powalko gmail com>
Date:   Mon Sep 17 14:40:03 2018 +0200

    Use list comprehensions
    
    https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions

 build/windows/jhbuild/makepkgs.py      | 5 +----
 plug-ins/pygimp/plug-ins/colorxhtml.py | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/build/windows/jhbuild/makepkgs.py b/build/windows/jhbuild/makepkgs.py
index ac794bf243..e0d2b4b1b5 100755
--- a/build/windows/jhbuild/makepkgs.py
+++ b/build/windows/jhbuild/makepkgs.py
@@ -19,12 +19,9 @@ def makearchive (dest, manifest, root):
 def parse_packagedb (packagedb_loc):
     """Parses a jhbuild packagedb.xml file"""
 
-    packages = []
-
     tree = ElementTree.parse (packagedb_loc)
     root = tree.getroot ()
-    for child in root:
-        packages.append (child.attrib)
+    packages = [child.attrib for child in root]
 
     return packages
 
diff --git a/plug-ins/pygimp/plug-ins/colorxhtml.py b/plug-ins/pygimp/plug-ins/colorxhtml.py
index 011f8cae97..6bf74de81a 100755
--- a/plug-ins/pygimp/plug-ins/colorxhtml.py
+++ b/plug-ins/pygimp/plug-ins/colorxhtml.py
@@ -94,10 +94,7 @@ def colorxhtml(img, drawable, filename, raw_filename,
 
     chars = chars.translate(allchars, badchars)
 
-    data = []
-
-    for c in chars:
-        data.append(escape_table.get(c, c))
+    data = [escape_table.get(c, c) for c in chars]
 
     if data:
         data.reverse()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]