Simplify the implementation of config.__iter__ and also implement iterkeys().
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 21:14:56 +0000 (21:14 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 21:14:56 +0000 (21:14 -0000)
svn path=/main/trunk/; revision=6919

pym/portage/__init__.py

index bf66dc4d2f008bb94414cc6d71b374ac89c24b1c..bfc6f08399411c4daa2e50e9d8d8090f6f38ccaa 100644 (file)
@@ -2230,11 +2230,11 @@ class config(object):
        def __iter__(self):
                keys = set()
                for d in self.lookuplist:
-                       for k in d:
-                               if k in keys:
-                                       continue
-                               keys.add(k)
-                               yield k
+                       keys.update(d)
+               return iter(keys)
+
+       def iterkeys(self):
+               return iter(self)
 
        def __setitem__(self,mykey,myvalue):
                "set a value; will be thrown away at reset() time"