From: Tim Peters Date: Sun, 25 Aug 2002 19:47:54 +0000 (+0000) Subject: Gave __xor__/symmetric_difference a factor of 2-5 speed boost. X-Git-Tag: v2.3c1~4288 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=334b4a5c393fba0b3cf37ed88b36cbd554a24f4f;p=thirdparty%2FPython%2Fcpython.git Gave __xor__/symmetric_difference a factor of 2-5 speed boost. --- diff --git a/Lib/sets.py b/Lib/sets.py index 10138fca5e1a..bf3ff4df5ea7 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -197,11 +197,13 @@ class BaseSet(object): result = self.__class__() data = result._data value = True - for elt in self: - if elt not in other: + selfdata = self._data + otherdata = other._data + for elt in selfdata: + if elt not in otherdata: data[elt] = value - for elt in other: - if elt not in self: + for elt in otherdata: + if elt not in selfdata: data[elt] = value return result