-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

while looking through portage code, I saw, that portage_dep.strip_empty
also modifies the passed list _in place_:

|>> l = [0,1,2,3,4]
|>> strip_empty(l)
[1, 2, 3, 4]
|>> l
[1, 2, 3, 4]

I don't know if this is wanted behavior - but as it is not documented, I
doubt it :)

Thus - a small patch: And now using filter for this task :). I hope
nothing relies on the side-effect desribed above.

Regards,
Necoro
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH2CUK4UOg/zhYFuARAp+PAJ9sLQ/M7OQGTLZN8RBaOwEdvKZ9tACeIq51
DqAXNQHuM9CqoFaR14EiRyQ=
=Nb2a
-----END PGP SIGNATURE-----
--- portage_dep.py.old  2008-03-12 09:06:00.000000000 +0100
+++ portage_dep.py      2008-03-12 09:06:44.000000000 +0100
@@ -44,10 +44,7 @@
        @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 filter(None, myarr)
 
 def paren_reduce(mystr,tokenize=1):
        """

Reply via email to