[issue44750] .popitem() is inconsistent in collections and collections.abc

2021-07-27 Thread Alex Waygood
Alex Waygood added the comment: Thanks, Raymond -- that makes sense, and seems very fair. I still think a note somewhere in the documentation stating this might be helpful -- as a user, it wasn't what I was expecting. I would argue this is especially true for UserDict, a class which the name

[issue44750] .popitem() is inconsistent in collections and collections.abc

2021-07-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Alex, thank for noticing this, but it is not a bug. MutableMapping is meant to describe all mapping classes including those that don't remember insertion order. The builtin dict() type implements MutableMapping but also adds ordering guarantees. It is c

[issue44750] .popitem() is inconsistent in collections and collections.abc

2021-07-27 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +rhettinger, stutzbach ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue44750] .popitem() is inconsistent in collections and collections.abc

2021-07-27 Thread Alex Waygood
New submission from Alex Waygood : In a Python dictionary, `.popitem()` returns (key, value) pairs from the dictionary in a LIFO order. `collections.OrderedDict` and `collections.Counter` both do the same. However, a class inheriting from `collections.abc.MutableMapping` (which includes, in t