]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/util/set.py
1 # (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
2 # distribute this software is granted provided this copyright notice appears in
3 # all copies. This software is provided "as is" without express or implied
4 # warranty, and with no claim as to its suitability for any purpose.
6 from b2
.util
import is_iterable
7 from .utility
import to_seq
10 def difference (b
, a
):
11 """ Returns the elements of B that are not in A.
20 def intersection (set1
, set2
):
21 """ Removes from set1 any items which don't appear in set2 and returns the result.
23 assert is_iterable(set1
)
24 assert is_iterable(set2
)
31 def contains (small
, large
):
32 """ Returns true iff all elements of 'small' exist in 'large'.
34 small
= to_seq (small
)
35 large
= to_seq (large
)
43 """ Returns True iff 'a' contains the same elements as 'b', irrespective of their order.
44 # TODO: Python 2.4 has a proper set class.
48 return contains (a
, b
) and contains (b
, a
)