But that use case is not about an empty file. It's about finding nothing at
the current position where something was expected. This is similar to the
original use case for EOFError, which was raised by input() (or rather,
raw_input()) when there was no more data on sys.stdin.

On Sun, Jun 26, 2016 at 5:22 PM, Rob Cliffe <rob.cli...@btinternet.com>
wrote:

> So how about an EmptyFileError (or similar name) as a subclass of EOFError?
>
> On 26/06/2016 21:42, Guido van Rossum wrote:
>
> I think this is an interesting idea and quite in line with the meaning of
> EOFError.
>
> --Guido (mobile)
> On Jun 26, 2016 5:02 AM, "André Malo" <n...@perlig.de> wrote:
>
>> * Serhiy Storchaka wrote:
>>
>> > 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.
>>
>> Yes (as said). In my case it's typically not a problem, because I write
>> them
>> myself right before reading them. It's a basically about spooling data to
>> disk in order to keep them out of the RAM.
>> However, because of the truncation issue it would be nice, to have a
>> distinction between no-data and truncated-data.
>>
>> Cheers,
>> --
>> Winnetous Erbe: <http://pub.perlig.de/books.html#apache2>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev@python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>
>
> _______________________________________________
> Python-Dev mailing 
> listPython-Dev@python.orghttps://mail.python.org/mailman/listinfo/python-dev
>
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/rob.cliffe%40btinternet.com
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@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)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to