2.4isms for bzr

Aaron Bentley aaron.bentley at utoronto.ca
Tue Jul 26 18:42:11 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel wrote:
> I agree that having communicate be one time is a little bit of a pain,
> but I think it is for simplicity, and the fact that a lot of times, that
> is all you need.

Sure, it's just that everyone says subprocess is the greatest thing
since sliced wheels, and this seems like an oversight.

> And it depends what you mean by "efficient", because your above code
> just buffers everything in ram, which is what communicate does.

It doesn't require you to generate one big string for stdin-- it can be
an iterator, which is more eficient.  You can also imagine writing an
iterator that yields stdout and does something else with stderr.  Or
yields stderr and writes stdout to disk.  Endless possibilities for
efficient handling!

> Heck, make iter_communicate support having input being a generator, and
> you could even have bi-directional communications with another process,
> while having it only really look like a loop.

Exactly the kind of thing I mean.  Especially if 2.5 introduces
iterators with send() (which is under discussion), it would be criminal
not supporting this mode of operation.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC5nXz0F+nu1YWqI0RAqpZAJ94oj1EKUCDAPdRBlxPJyaCcJ2/+ACfd4wf
PsE7kXtUnLc15cH9ZTDRT/E=
=goHW
-----END PGP SIGNATURE-----




More information about the bazaar mailing list