Lines Matching refs:other
13 their elements have a definite order; sets on the other hand don't
54 # - Raymond Hettinger added a number of speedups and other
113 def __cmp__(self, other):
123 # NotImplemented instead of True or False. Then the other comparand
124 # would get a chance to determine the result, and if the other comparand
131 def __eq__(self, other):
132 if isinstance(other, BaseSet):
133 return self._data == other._data
137 def __ne__(self, other):
138 if isinstance(other, BaseSet):
139 return self._data != other._data
173 # correct when the type of other isn't suitable. For example, if
178 def __or__(self, other):
183 if not isinstance(other, BaseSet):
185 return self.union(other)
187 def union(self, other):
193 result._update(other)
196 def __and__(self, other):
201 if not isinstance(other, BaseSet):
203 return self.intersection(other)
205 def intersection(self, other):
210 if not isinstance(other, BaseSet):
211 other = Set(other)
212 if len(self) <= len(other):
213 little, big = self, other
215 little, big = other, self
219 def __xor__(self, other):
224 if not isinstance(other, BaseSet):
226 return self.symmetric_difference(other)
228 def symmetric_difference(self, other):
238 otherdata = other._data
240 otherdata = Set(other)._data
247 def __sub__(self, other):
250 (I.e. all elements that are in this set and not in the other.)
252 if not isinstance(other, BaseSet):
254 return self.difference(other)
256 def difference(self, other):
259 (I.e. all elements that are in this set and not in the other.)
264 otherdata = other._data
266 otherdata = Set(other)._data
289 def issubset(self, other):
291 self._binary_sanity_check(other)
292 if len(self) > len(other): # Fast check for obvious cases
294 for elt in ifilterfalse(other._data.__contains__, self):
298 def issuperset(self, other):
300 self._binary_sanity_check(other)
301 if len(self) < len(other): # Fast check for obvious cases
303 for elt in ifilterfalse(self._data.__contains__, other):
311 def __lt__(self, other):
312 self._binary_sanity_check(other)
313 return len(self) < len(other) and self.issubset(other)
315 def __gt__(self, other):
316 self._binary_sanity_check(other)
317 return len(self) > len(other) and self.issuperset(other)
324 def _binary_sanity_check(self, other):
325 # Check that the other argument to a binary operation is also
327 if not isinstance(other, BaseSet):
428 def __ior__(self, other):
430 self._binary_sanity_check(other)
431 self._data.update(other._data)
434 def union_update(self, other):
436 self._update(other)
438 def __iand__(self, other):
440 self._binary_sanity_check(other)
441 self._data = (self & other)._data
444 def intersection_update(self, other):
446 if isinstance(other, BaseSet):
447 self &= other
449 self._data = (self.intersection(other))._data
451 def __ixor__(self, other):
453 self._binary_sanity_check(other)
454 self.symmetric_difference_update(other)
457 def symmetric_difference_update(self, other):
461 if not isinstance(other, BaseSet):
462 other = Set(other)
463 if self is other:
465 for elt in other:
471 def __isub__(self, other):
473 self._binary_sanity_check(other)
474 self.difference_update(other)
477 def difference_update(self, other):
480 if not isinstance(other, BaseSet):
481 other = Set(other)
482 if self is other:
484 for elt in ifilter(data.__contains__, other):