
On Tue, Jun 30, 2015 at 12:10 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
Steven D'Aprano <steve@pearwood.info> writes:
Yeah, I always forget which is fd 0 and which is fd 1 too.
Having nice descriptive names rather than using numbered indexes is generally better practice
I definitely prefer to use, and promote, the explicit names “stdin”, “stdout”, and “stderr” rather than the file descriptor numbers.
On the point of confusing them though: I find it easy enough to remember that the two streams for output stay together, and the input one comes first at 0.
and I don't think there is any serious downside to using a namedtuple. A minor enhancement like this shouldn't require an extended discussion here on python-ideas.
+1, let's just get the standard names there as attributes of a namedtuple.
Except that this isn't about stdin/stdout - that just happens to make a neat mnemonic. This is about a pipe, which has a reading end and a writing end. If you pass one of those to another process to use as its stdout, you'll be reading from the reading end; calling it "stdin" would be confusing, since you're getting what the process wrote to stdout. How about just "read" and "write"? Yep, Cameron was right... ChrisA