[Python-ideas] make Connections iterable

Nick Coghlan ncoghlan at gmail.com
Tue Jan 9 05:46:35 EST 2018

On 9 January 2018 at 20:07, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Mon, 8 Jan 2018 21:22:56 -0800
> Nathaniel Smith <njs at pobox.com> wrote:
>> 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.

If you view them as comparable to subprocess pipes, then it can be
surprising that they're not iterable when using a line-oriented

If you instead view them as comparable to socket connections, then the
lack of iteration support seems equally reasonable.

Hence my suggestion of providing a docs recipe showing an example of
wrapping a connection in a generator in order to define a suitable way
of getting from a raw bytestream to iterable chunks.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list