marshal doesn't work with "file-like" objects
Tim Peters
tim.one at home.com
Mon Jan 29 18:35:19 EST 2001
[Tim]
> ...
> You could do this instead:
>
> filelikeobject.write(marshal.dumps(object))
>
> Reading a sequence of marshaled values back from a file-like
> object is more of a puzzle!
[/F, to Chuck]
> ...
> Note the second part ("more of a puzzle" is a polite way to say
> "impossible, if you care about performance").
That wasn't my intent, but I confess I don't have time or interest to flesh
it out. Sketch: if Chuck wants a filelike object to marshal in and out of,
he can craft a filelike object that also tucks away an index (or length
prefixes, a la Rainer's followup), so he can know in advance how much of the
stream needs to be read.
I've got no interest in seeing such cruft added to the Python core, though.
marhsal-works-great-for-what-it-was-designed-for-ly y'rs - tim
More information about the Python-list
mailing list