diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-05-08 10:37:34 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-05-08 10:37:34 -0700 |
commit | 3a688dc4b7e0a023a7654cc47c390cc88606d57f (patch) | |
tree | 0dc9e2a2e6b36dbc6f172d07fcef93f56ee3d6fe /mesonbuild/mesonlib.py | |
parent | 93187797d69d679f62d663323680dd7a611adce1 (diff) | |
download | meson-3a688dc4b7e0a023a7654cc47c390cc88606d57f.zip meson-3a688dc4b7e0a023a7654cc47c390cc88606d57f.tar.gz meson-3a688dc4b7e0a023a7654cc47c390cc88606d57f.tar.bz2 |
Implement difference method for OrderedSet
This implementation is obvious rather than efficient, but it's efficient
enough for our uses I think. It uses `type(self)` to guarantee that it
works even in subclasses or if the name of the class changes.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index d97ebbe..7248be9 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -722,3 +722,6 @@ class OrderedSet(collections.MutableSet): def update(self, iterable): for item in iterable: self.__container[item] = None + + def difference(self, set_): + return type(self)(e for e in self if e not in set_) |