]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Gave issubet() and issuperset() major speed boosts. That's it for now!
authorTim Peters <tim.peters@gmail.com>
Sun, 25 Aug 2002 20:12:19 +0000 (20:12 +0000)
committerTim Peters <tim.peters@gmail.com>
Sun, 25 Aug 2002 20:12:19 +0000 (20:12 +0000)
Someone else may want to tackle the mutating operations similarly.

Lib/sets.py

index 466537387a643018c6c61ebd36104be95f1b735c..e33464b58e232df052de4448e2d73890022c8f91 100644 (file)
@@ -259,8 +259,9 @@ class BaseSet(object):
         self._binary_sanity_check(other)
         if len(self) > len(other):  # Fast check for obvious cases
             return False
+        otherdata = other._data
         for elt in self:
-            if elt not in other:
+            if elt not in otherdata:
                 return False
         return True
 
@@ -269,8 +270,9 @@ class BaseSet(object):
         self._binary_sanity_check(other)
         if len(self) < len(other):  # Fast check for obvious cases
             return False
+        selfdata = self._data
         for elt in other:
-            if elt not in self:
+            if elt not in selfdata:
                 return False
         return True