]> granicus.if.org Git - python/commitdiff
Change PrettyPrinter.pprint(), so that output is written directly to the
authorWalter Dörwald <walter@livinglogic.de>
Fri, 11 Nov 2005 18:18:51 +0000 (18:18 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Fri, 11 Nov 2005 18:18:51 +0000 (18:18 +0000)
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.

Lib/pprint.py

index da6ab1a9c7ac4f4bcf274577a11d472ce059532b..f77a0e224832fb012a37c2011533e0eee61f77f1 100644 (file)
@@ -103,7 +103,8 @@ class PrettyPrinter:
             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()