pprint's workhorse _safe_repr() function took time quadratic in the # of
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.
diff --git a/Misc/NEWS b/Misc/NEWS
index 9a343ad..2290a10 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -92,6 +92,8 @@
- pprint.isrecursive(object) didn't correctly identify recursive objects.
Now it does.
+- pprint functions now much faster for large containers (tuple, list, dict).
+
Tests
- New test_mutants.py runs dict comparisons where the key and value
@@ -100,7 +102,8 @@
of heart: it can also cause Win9x to freeze or reboot!).
- New test_pprint.py verfies that pprint.isrecursive() and
- pprint.isreadable() return sensible results.
+ pprint.isreadable() return sensible results. Also verifies that simple
+ cases produce correct output.
What's New in Python 2.1 (final)?