1

popitem() in dictionary guarantee to return last inserted pair for 3.7 and onward. Dictionary is unordered type. So, how dictionary is able to achieve this?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Vikrant
  • 1,149
  • 12
  • 19

1 Answers1

1

It is no longer unordered starting 3.6 (implementation detail) and guaranteed as of 3.7. So naturally methods that are based on order have predictable results now.

See Are dictionaries ordered in Python 3.6+?

Anonymous
  • 11,740
  • 3
  • 40
  • 50