[Python-ideas] Tulip / PEP 3156 (original) (raw)

[Python-ideas] Tulip / PEP 3156 - subprocess events

Antoine Pitrou solipsis at pitrou.net
Tue Jan 22 14:49:36 CET 2013


Le Tue, 22 Jan 2013 23:34:48 +1000, Nick Coghlan <ncoghlan at gmail.com> a écrit :

Also, I agree with the comment someone else made that attempting to pair stdin with either stderr or stdout is a bad idea - better to treat them as three independent transports (as the subprocess module does), so that the close() semantics and error handling are clear. sockets are different, as those actually are bidirectional data streams, whereas pipes are unidirectional.

+1

I don't know whether it's worth defining separate SimplexTransmit (e.g. stdin pipe in parent process, stdout, stderr pipes in child process), SimplexReceive (stdout, stderr pipes in parent process, stdin pip in child process), HalfDuplex (e.g. some radio transmitters) and FullDuplex (e.g. sockets) transport abstractions - I guess if Twisted haven't needed them, it probably isn't worth bothering.

It's an implementation detail, since the user should only see transport instances, not transport classes. (until the user tries to write their own transport, that is)

Regards

Antoine.



More information about the Python-ideas mailing list