[Python-ideas] Make os.pipe() return a namedtuple.

Jonathan Slenders jonathan at slenders.be
Tue Jun 30 09:02:05 CEST 2015


If we use "read" and write as names. It means that often we end up writing
code like this:

os.write(our_pipe.write, data)
os.read(our_pipe.read)

Is that ok? I mean, it's not confusing that the os.read is a method, while
pip.read is an attribute.

Jonathan




2015-06-30 8:07 GMT+02:00 Cameron Simpson <cs at zip.com.au>:

> On 30Jun2015 12:14, Chris Angelico <rosuav at gmail.com> wrote:
>
>> On Tue, Jun 30, 2015 at 12:10 PM, Ben Finney <ben+python at benfinney.id.au>
>> wrote:
>>
>>> Steven D'Aprano <steve at pearwood.info> writes:
>>>
>>>> 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"?
>>
>
> +1 for "read" and "write" for me. And -1 on "stdin" and "stdout" for the
> same reason as outlined above.
>
> Cheers,
> Cameron Simpson <cs at zip.com.au>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150630/d830f8cd/attachment.html>


More information about the Python-ideas mailing list