MCPcopy Index your code
hub / github.com/grantjenks/python-sortedcontainers / difference

Method difference

sortedcontainers/sortedset.py:480–499  ·  view source on GitHub ↗

Return the difference of two or more sets as a new sorted set. The `difference` method also corresponds to operator ``-``. ``ss.__sub__(iterable)`` <==> ``ss - iterable`` The difference is all values that are in this sorted set but not the other `iterables`.

(self, *iterables)

Source from the content-addressed store, hash-verified

478
479
480 def difference(self, *iterables):
481 """Return the difference of two or more sets as a new sorted set.
482
483 The `difference` method also corresponds to operator ``-``.
484
485 ``ss.__sub__(iterable)`` <==> ``ss - iterable``
486
487 The difference is all values that are in this sorted set but not the
488 other `iterables`.
489
490 >>> ss = SortedSet([1, 2, 3, 4, 5])
491 >>> ss.difference([4, 5, 6, 7])
492 SortedSet([1, 2, 3])
493
494 :param iterables: iterable arguments
495 :return: new sorted set
496
497 """
498 diff = self._set.difference(*iterables)
499 return self._fromset(diff, key=self._key)
500
501 __sub__ = difference
502

Callers 1

test_differenceFunction · 0.95

Calls 1

_fromsetMethod · 0.95

Tested by 1

test_differenceFunction · 0.76