MutableSets support a remove() method.
This commit is contained in:
parent
abf3fcf39f
commit
7d518f418b
|
@ -250,6 +250,12 @@ class MutableSet(Set):
|
||||||
"""Return True if it was deleted, False if not there."""
|
"""Return True if it was deleted, False if not there."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def remove(self, value):
|
||||||
|
"""Remove an element. If not a member, raise a KeyError."""
|
||||||
|
if value not in self:
|
||||||
|
raise KeyError(value)
|
||||||
|
self.discard(value)
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
"""Return the popped value. Raise KeyError if empty."""
|
"""Return the popped value. Raise KeyError if empty."""
|
||||||
it = iter(self)
|
it = iter(self)
|
||||||
|
|
Loading…
Reference in New Issue