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.
@@ -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_)
