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.
pull/1758/head
Dylan Baker 8 years ago
parent 93187797d6
commit 3a688dc4b7
  1. 3
      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_)

Loading…
Cancel
Save