On Tue, Jan 9, 2018 at 2:07 AM, Antoine Pitrou <solip...@pitrou.net> wrote:
> On Mon, 8 Jan 2018 21:22:56 -0800
> Nathaniel Smith <n...@pobox.com> wrote:
>>
>> The only documented error from multiprocessing.Connection.recv is EOFError,
>> which is basically equivalent to a StopIteration.
>
> Actually recv() can raise an OSError corresponding to any system-level
> error.
>
>> I'm surprised that multiprocessing.Connection isn't iterable -- it seems
>> like an obvious oversight.
>
> What is obvious about making a connection iterable?  It's the first
> time I see someone requesting this.

On the receive side, it's a stream of incoming objects that you fetch
one at a time until you get to the end, probably processed with a loop
like:

while True:
    try:
        next_message = conn.recv()
    except EOFError:
        break
    ...

Why wouldn't it be iterable?

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to