A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-June/145417.html below:

[Python-Dev] When to use EOFError?

[Python-Dev] When to use EOFError? [Python-Dev] When to use EOFError?Serhiy Storchaka storchaka at gmail.com
Sat Jun 25 17:26:26 EDT 2016
On 22.06.16 19:22, André Malo wrote:
> I often concatenate multiple pickles into one file. When reading them, it
> works like this:
>
> try:
>      while True:
>          yield pickle.load(fp)
> except EOFError:
>      pass
>
> In this case the truncation is not really unexpected. Maybe it should
> distinguish between truncated-in-the-middle and truncated-because-empty.
>
> (Same goes for marshal)

This is interesting application, but works only for non-truncated data. 
If the data is truncated, you just lose the last item without a notice.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4