dynamic allocation file buffer

Aaron "Castironpi" Brady castironpi at gmail.com
Fri Sep 12 07:26:27 CEST 2008

On Sep 11, 10:37 pm, Steven D'Aprano
<ste... at REMOVE.THIS.cybersource.com.au> wrote:
> On Thu, 11 Sep 2008 10:20:41 -0700, Aaron \"Castironpi\" Brady wrote:
> > XML is the wrong word for the example I was thinking of (as was already
> > pointed out in another thread).  XML is by definition sequential.
> I'm pretty sure you're wrong. XML can be used for serialization, but that
> doesn't mean it is only sequential data. XML is suitable for hierarchical
> data too. To quote Wikipedia:
> "As long as only well-formedness is required, XML is a generic framework
> for storing any amount of text or any data whose structure can be
> represented as a tree. The only indispensable syntactical requirement is
> that the document has exactly one root element (alternatively called the
> document element)."
> http://en.wikipedia.org/wiki/Xml
> --
> Steven

That's my choice of words at work again, I'm afraid.  What I mean is,
there is no possibility that you can correctly interpret a segment of
XML text without knowing certain facts about everything that precedes
it.  Compare to the case of a fixed-length record file, of record size
say 20, where you know the meaning of the characters in offset ranges
20-40, 80-100, 500020-500040, etc.

To clarify the point of the use case in question, because data would
be allocated and located dynamically, its possible that you could read
the first several words, then not need anything until say, the 1KB
mark.  (Unless you're somehow storing an offset in to an XML string as
a value in the string, which would require composing it, leaving room
for that value, and then writing it with random access anyway.)  There
can be gaps in a dynamically managed buffer--- say the unused/free
bytes from offsets 200 to 220, but every byte that follows another in
an XML file follows it in the file's meaning too.  Is this any


More information about the Python-list mailing list