Rename popitem() to pop(). (An idea from SF patch 597444.)

This commit is contained in:
Guido van Rossum 2002-08-20 21:51:59 +00:00
parent 5033b36c44
commit c9196bc88d
2 changed files with 3 additions and 3 deletions

View File

@ -420,7 +420,7 @@ class Set(BaseSet):
except KeyError:
pass
def popitem(self):
def pop(self):
"""Remove and return a randomly-chosen set element."""
return self._data.popitem()[0]

View File

@ -292,10 +292,10 @@ class TestMutate(unittest.TestCase):
self.set.clear()
assert len(self.set) == 0, "Clearing set"
def test_popitem(self):
def test_pop(self):
popped = {}
while self.set:
popped[self.set.popitem()] = None
popped[self.set.pop()] = None
assert len(popped) == len(self.values), "Popping items"
for v in self.values:
assert v in popped, "Popping items"