[pypy-commit] pypy set-strategies: we do not enforce EmptySetStrategy for empty sets

l.diekmann noreply at buildbot.pypy.org
Thu Nov 10 13:51:30 CET 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49215:2cedb79b6ae1
Date: 2011-10-11 14:02 +0200
http://bitbucket.org/pypy/pypy/changeset/2cedb79b6ae1/

Log:	we do not enforce EmptySetStrategy for empty sets

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -178,7 +178,6 @@
 
 class EmptySetStrategy(SetStrategy):
 
-    # XXX rename everywhere to erase and unerase
     erase, unerase = rerased.new_erasing_pair("empty")
     erase = staticmethod(erase)
     unerase = staticmethod(unerase)
@@ -240,11 +239,8 @@
         return False
 
     def equals(self, w_set, w_other):
-        # XXX can't this be written as w_other.strategy is self?
-        if w_other.strategy is self.space.fromcache(EmptySetStrategy):
+        if w_other.strategy is self or w_other.length() == 0:
             return True
-        # XXX let's not enforce the use of the EmptySetStrategy for empty sets
-        # similar to what we did for lists
         return False
 
     def difference(self, w_set, w_other):


More information about the pypy-commit mailing list