]> granicus.if.org Git - python/commitdiff
SF patch #907403: Improvements to cStringIO.writelines()
authorRaymond Hettinger <python@rcn.com>
Mon, 8 Mar 2004 18:22:35 +0000 (18:22 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 8 Mar 2004 18:22:35 +0000 (18:22 +0000)
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes the
method suitable for use with generator expressions.

Misc/NEWS

index f3554c389df3876d75860196071a7d4a0e759ec9..1fe8bf2388a5847a7c536b3f198f265555358fdc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -175,6 +175,11 @@ Core and builtins
 Extension modules
 -----------------
 
+- cStringIO.writelines() now accepts any iterable argument and writes
+  the lines one at a time rather than joining them and writing once.
+  Made a parallel change to StringIO.writelines().  Saves memory and
+  makes suitable for use with generator expressions.
+
 - time.strftime() now checks that the values in its time tuple argument
   are within the proper boundaries to prevent possible crashes from the
   platform's C library implementation of strftime().  Can possibly