[Python-checkins] r60432 - python/trunk/Lib/_abcoll.py

raymond.hettinger python-checkins at python.org
Wed Jan 30 01:08:31 CET 2008


Author: raymond.hettinger
Date: Wed Jan 30 01:08:31 2008
New Revision: 60432
Modified:
 python/trunk/Lib/_abcoll.py
Log:
MutableSets support a remove() method.
Modified: python/trunk/Lib/_abcoll.py
==============================================================================
--- python/trunk/Lib/_abcoll.py	(original)
+++ python/trunk/Lib/_abcoll.py	Wed Jan 30 01:08:31 2008
@@ -250,6 +250,12 @@
 """Return True if it was deleted, False if not there."""
 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):
 """Return the popped value. Raise KeyError if empty."""
 it = iter(self)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /