<p dir="ltr">I think this is an interesting idea and quite in line with the meaning of EOFError.</p>
<p dir="ltr">--Guido (mobile)</p>
<div class="gmail_quote">On Jun 26, 2016 5:02 AM, "André Malo" <<a href="mailto:nd@perlig.de">nd@perlig.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">* Serhiy Storchaka wrote:<br>
<br>
> On 22.06.16 19:22, André Malo wrote:<br>
> > I often concatenate multiple pickles into one file. When reading them,<br>
> > it works like this:<br>
> ><br>
> > try:<br>
> >      while True:<br>
> >          yield pickle.load(fp)<br>
> > except EOFError:<br>
> >      pass<br>
> ><br>
> > In this case the truncation is not really unexpected. Maybe it should<br>
> > distinguish between truncated-in-the-middle and<br>
> > truncated-because-empty.<br>
> ><br>
> > (Same goes for marshal)<br>
><br>
> This is interesting application, but works only for non-truncated data.<br>
> If the data is truncated, you just lose the last item without a notice.<br>
<br>
Yes (as said). In my case it's typically not a problem, because I write them<br>
myself right before reading them. It's a basically about spooling data to<br>
disk in order to keep them out of the RAM.<br>
However, because of the truncation issue it would be nice, to have a<br>
distinction between no-data and truncated-data.<br>
<br>
Cheers,<br>
--<br>
Winnetous Erbe: <<a href="http://pub.perlig.de/books.html#apache2" rel="noreferrer" target="_blank">http://pub.perlig.de/books.html#apache2</a>><br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</blockquote></div>