Make strip_empty() return a nedw list instead of working in-place. Thanks to
authorZac Medico <zmedico@gentoo.org>
Thu, 13 Mar 2008 18:04:50 +0000 (18:04 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 13 Mar 2008 18:04:50 +0000 (18:04 -0000)
RenĂ© Neumann <rene.neumann@necoro.net> for the suggestion.

svn path=/main/trunk/; revision=9460

pym/portage/dep.py

index bf42d2ba85cfe70e0adbbf646f8b315e283a6158..2a1a3cfa59a8e090d4ada8687cf9ffc4081ba780 100644 (file)
@@ -63,11 +63,7 @@ def strip_empty(myarr):
        @rtype: Array
        @return: The array with empty elements removed
        """
-
-       for x in range(len(myarr)-1, -1, -1):
-               if not myarr[x]:
-                       del myarr[x]
-       return myarr
+       return [x for x in myarr if x]
 
 def paren_reduce(mystr,tokenize=1):
        """