Iterating over marshal

Tim Lesher tlesher at gmail.com
Fri Oct 6 16:49:33 EDT 2006


On Oct 6, 4:19 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
> Tim Lesher wrote:
> > I'm using the marshal library to unmarshal a file containing one or
> > more objects.  The canonical way seems to be:
>
> > objs = []
> > while 1:
> >     try:
> >         objs.append(marshal.load(fobj))
> >     except EOFError:
> >         breakthe canonical way to do this is to put the objects in a sequence
> container *before* marshalling them.

That makes sense; unfortunately, I'm unmarshalling from an external
data source I don't control (the Perforce version control client).

-- 
Tim Lesher
tlesher at gmail.com




More information about the Python-list mailing list