diff Lib/pprint.py @ 35852:ee3e0ee1edca legacy-trunk

Change PrettyPrinter.pprint(), so that output is written directly to the output stream, instead of writing it to a StringIO first and writing the result of this to the output stream. This should speed up the initial output.
author Walter Dörwald <walter@livinglogic.de>
date Fri, 11 Nov 2005 18:18:51 +0000
parents 6771e1840bbc
children 2eb8be0f8731
line wrap: on
line diff
--- a/Lib/pprint.py	Wed Nov 09 21:42:48 2005 +0000
+++ b/Lib/pprint.py	Fri Nov 11 18:18:51 2005 +0000
@@ -103,7 +103,8 @@
             self._stream = _sys.stdout
 
     def pprint(self, object):
-        self._stream.write(self.pformat(object) + "\n")
+        self._format(object, self._stream, 0, 0, {}, 0)
+        self._stream.write("\n")
 
     def pformat(self, object):
         sio = _StringIO()