[Python-Dev] When to use EOFError?

Guido van Rossum guido at python.org
Mon Jun 27 18:20:40 EDT 2016


The point is that it's not an error. In Andre Malo's use case, at
least, EOFError is used as a control flow exception, not as an error.

On Mon, Jun 27, 2016 at 3:06 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 06/27/2016 02:54 PM, Greg Ewing wrote:
>>
>> Nikolaus Rath wrote:
>>>
>>> I think EOFError conveys more information. UnpicklingError can mean a
>>> lot of things, EOFError tells you the precise problem: pickle expected
>>> more data, but there was nothing left.
>>
>>
>> I think EOFError should be used for EOF between pickles,
>> but UnpicklingError should be used for EOF in the middle of
>> a pickle. The former is not necessarily an error, but the
>> latter definitely is.
>
>
> Why is hitting the end of a file between pickles an error?
>
> --
> ~Ethan~
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list