File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1346,7 +1346,14 @@ attribute.
13461346 A real dictionary used to store the contents of the :class: `UserDict `
13471347 class.
13481348
1349+ :class: `!UserDict ` instances also override the following method:
13491350
1351+ .. method :: popitem
1352+
1353+ Remove and return a ``(key, value) `` pair from the wrapped dictionary. Pairs are
1354+ returned in in the same order as :func: `.data.popitem `. (For the default
1355+ :meth: `dict.popitem `, this order is :abbr: `LIFO ( last-in, first-out ) `.) If the
1356+ dictionary is empty, raises a :exc: `KeyError `.
13501357
13511358:class: `UserList ` objects
13521359-------------------------
Original file line number Diff line number Diff line change @@ -1257,6 +1257,13 @@ def copy(self):
12571257 # This method has a default implementation in MutableMapping, but dict's
12581258 # equivalent is last-in, first-out instead of first-in, first-out.
12591259 def popitem (self ):
1260+ """Remove and return a (key, value) pair as a 2-tuple.
1261+
1262+ Removes pairs in the same order as the wrapped mapping's popitem()
1263+ method. For dict objects (the default), that order is last-in,
1264+ first-out (LIFO).
1265+ Raises KeyError if the UserDict is empty.
1266+ """
12601267 return self .data .popitem ()
12611268
12621269
You can’t perform that action at this time.
0 commit comments