summaryrefslogtreecommitdiff
path: root/Lib/sets.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-25 20:12:19 +0000
committerTim Peters <tim.peters@gmail.com>2002-08-25 20:12:19 +0000
commit3198c2abefb83d40d64bf873f55b782074e7a042 (patch)
treec81cc9a4f055996f5a9c247e83a177698a3a48f2 /Lib/sets.py
parent118a737f3326c9e05d09982781a029fe51b23c37 (diff)
downloadcpython-3198c2abefb83d40d64bf873f55b782074e7a042.tar.gz
Gave issubet() and issuperset() major speed boosts. That's it for now!
Someone else may want to tackle the mutating operations similarly.
Diffstat (limited to 'Lib/sets.py')
-rw-r--r--Lib/sets.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/sets.py b/Lib/sets.py
index 466537387a..e33464b58e 100644
--- a/Lib/sets.py
+++ b/Lib/sets.py
@@ -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