Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,13 @@ def copy(self):
c.update(self)
return c


# This method has a default implementation in MutableMapping, but dict's
# equivalent is last-in, first-out instead of first-in, first-out.
def popitem(self):
return self.data.popitem()


@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Causes the ``popitem`` method for ``collections.UserDict`` to pop in last-in, first-out order rather than first-in, first-out. The former has been the default for ``dict`` instances since Python 3.7, so this change will make subclasses of ``UserDict`` behave more like ``dict``.
Loading