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

Jonathan Slenders jonathan at slenders.be
Tue Jun 30 09:22:24 CEST 2015


I created an issue:
http://bugs.python.org/issue24536

readfd/writefd sounds like a good choice, but it's still open for
discussion.

2015-06-30 9:11 GMT+02:00 Nathaniel Smith <njs at pobox.com>:

> On Tue, Jun 30, 2015 at 12:03 AM, Chris Angelico <rosuav at gmail.com> wrote:
> > On Tue, Jun 30, 2015 at 5:02 PM, Jonathan Slenders <jonathan at slenders.be>
> wrote:
> >> 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.
> >
> > I'd much rather that than the converse. You always put read with read,
> > you always put write with write.
>
> It also appears to be the way that everyone is already naming their
> variables:
>
>
> https://codesearch.debian.net/perpackage-results/os%5C.pipe%20filetype%3Apython/2/page_0
>
> I see returns named "r, w", "rout, wout", "rfd, wfd", "rfd,
> self.writepipe", "readfd, writefd", "p2cread, p2cwrite", etc.
>
> Maybe readfd/writefd or read_fileno/write_fileno would be a little
> better than plain read/write, both to remind the user that these are
> fds rather than file objects and to make the names nouns instead of
> verbs. But really read/write is fine too.
>
> -n
>
> --
> Nathaniel J. Smith -- http://vorpus.org
> _______________________________________________
> 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/649e8e4a/attachment.html>


More information about the Python-ideas mailing list