pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
diff --git a/Misc/NEWS b/Misc/NEWS
index fdfde1e..d54928e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -101,6 +101,12 @@
Library
-------
+- The functions in the ``pprint`` module now sort dictionaries by key
+ before computing the display. Before 2.5, ``pprint`` sorted a dictionary
+ if and only if its display required more than one line, although that
+ wasn't documented. The new behavior increases predictability; e.g.,
+ using ``pprint.pprint(a_dict)`` in a doctest is now reliable.
+
- Patch #1497027: try HTTP digest auth before basic auth in urllib2
(thanks for J. J. Lee).