From: Walter Dörwald Date: Fri, 11 Nov 2005 18:18:51 +0000 (+0000) Subject: Change PrettyPrinter.pprint(), so that output is written directly to the X-Git-Tag: v2.5a0~1181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e62e936e797e6f30ee81932abe5a4e5f9f2f6f85;p=python 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. --- diff --git a/Lib/pprint.py b/Lib/pprint.py index da6ab1a9c7..f77a0e2248 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -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()