[Python-checkins] commit of r41422 - python/trunk/Lib

walter.doerwald@python.org walter.doerwald at python.org
Fri Nov 11 19:18:51 CET 2005


Author: walter.doerwald
Date: Fri Nov 11 19:18:51 2005
New Revision: 41422
Modified:
 python/trunk/Lib/pprint.py
Log:
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.
Modified: python/trunk/Lib/pprint.py
==============================================================================
--- python/trunk/Lib/pprint.py	(original)
+++ python/trunk/Lib/pprint.py	Fri Nov 11 19:18:51 2005
@@ -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()


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /