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.
Pass the right number of args to .format(). (Caught by
pychecker.)
- Protect the global namespace more carefully.
- Don't use the types module now that we don't need to.
elements when crunching a list, dict or tuple. Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
- handles recursive data structures
- formatting based on a PrettyPrinter object
- allows a maximum nesting depth to be specified
- provides safe repr()-like function which does not pretty-print
(with some slight formatting changes).
Feature requests:
- Make it a class (everything should be a class);
- support recursive data structures (like pp.py on the ftp contrib site).