ElementTree should parse string and file in the same way

Fredrik Lundh fredrik at pythonware.com
Thu Jan 3 09:15:29 EST 2008


Stefan Behnel wrote:

>> also, putting large documents in a *single* Python string can be quite
>> inefficient.  it's often more efficient to use lists of string fragments.
> 
> That's a pretty general statement. Do you mean in terms of reading from that
> string (which at least in lxml is a straight forward extraction of a char*/len
> pair which is passed into libxml2), constructing that string (possibly from
> partial strings, which temporarily *is* expensive) or just keeping the string
> in memory?

overall I/O throughput.  it's of course construction and internal 
storage that are the main issues here; every extra copy has a cost, and 
if you're working with multi-megabyte resources, the extra expenses 
quickly become noticeable.

</F>




More information about the Python-list mailing list