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

svn path=/main/branches/2.1.2/; revision=9552

pym/portage_dep.py

index 2ac6ada99b26f8cddd3bfe3615153297f0075f06..5bb9c05623f9bd651a2c51fd1841e98244c55f26 100644 (file)
@@ -44,10 +44,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):
        """