[Patches] [ python-Patches-907403 ] Improvements to cStringIO.writelines()

SourceForge.net noreply at sourceforge.net
Mon Mar 1 04:35:04 EST 2004


Patches item #907403, was opened at 2004-03-01 04:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=907403&group_id=5470

Category: Modules
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Improvements to cStringIO.writelines()

Initial Comment:
Currently, cStringIO.writelines() only accepts a 
sequence argument and it passes that argument 
internally to str.join() to construct a large temporary 
string before writing.

The patch allows the method to accept any iterable 
argument and for the lines to be written one at a time 
which cuts memory utilization in half.

The result is especially valuable when used with 
generators or itertools because the strings are 
constructed on the fly rather than all at once.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=907403&group_id=5470



More information about the Patches mailing list