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

Method intersection

sortedcontainers/sortedset.py:536–555  ·  view source on GitHub ↗

Return the intersection of two or more sets as a new sorted set. The `intersection` method also corresponds to operator ``&``. ``ss.__and__(iterable)`` <==> ``ss & iterable`` The intersection is all values that are in this sorted set and each of the other `iterable

(self, *iterables)

Source from the content-addressed store, hash-verified

534
535
536 def intersection(self, *iterables):
537 """Return the intersection of two or more sets as a new sorted set.
538
539 The `intersection` method also corresponds to operator ``&``.
540
541 ``ss.__and__(iterable)`` <==> ``ss & iterable``
542
543 The intersection is all values that are in this sorted set and each of
544 the other `iterables`.
545
546 >>> ss = SortedSet([1, 2, 3, 4, 5])
547 >>> ss.intersection([4, 5, 6, 7])
548 SortedSet([4, 5])
549
550 :param iterables: iterable arguments
551 :return: new sorted set
552
553 """
554 intersect = self._set.intersection(*iterables)
555 return self._fromset(intersect, key=self._key)
556
557 __and__ = intersection
558 __rand__ = __and__

Callers 1

test_intersectionFunction · 0.95

Calls 1

_fromsetMethod · 0.95

Tested by 1

test_intersectionFunction · 0.76