On 8/3/2011 11:29 AM, Phlip wrote:
This is either a code snippet, if you like it, or a request for a critique, if you don't.
A learning exercise but pretty useless otherwise. As others pointed out, immediately stripping off \n is a bug relative to *your* function description. Also, you yourself then give an example of joining with \n. But that does not restore the final \n. The rest duplicates the iteration ability of the .stdout file object.
For repeated execution of code like process.stdout.readline() you can once create a 'packetized' bound method object like so cmdline = process.stdout.readline and then, without repeating the attribute lookups, repeatedly call cmdline() . -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list