[PATCH 1/2] Replace filter() call with list comprehension

Vratislav Podzimek vpodzime at redhat.com
Fri Feb 20 14:06:56 UTC 2015


The list comprehension works the same way in both Python 2 and Python 3.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 src/parted/disk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/parted/disk.py b/src/parted/disk.py
index 3f293e2..a450c08 100644
--- a/src/parted/disk.py
+++ b/src/parted/disk.py
@@ -395,7 +395,7 @@ class Disk(object):
             return None
 
     def __filterPartitions(self, fn):
-        return filter(fn, self.partitions)
+        return [part for part in self.partitions if fn(part)]
 
     def getLogicalPartitions(self):
         """Return a list of logical Partitions on this Disk."""
-- 
2.1.0



More information about the anaconda-patches mailing list