[Python-ideas] allow overriding files used for the input builtin

Wren Turkal w00t at fb.com
Mon Oct 2 12:08:56 EDT 2017


I just realized that I had not responded to you. I’m sorry for not replying to the message as this was one of the messages that came in digest form. I am referring to your message here: https://mail.python.org/pipermail/python-ideas/2017-September/047238.html

I looked over your comment about how input() should be like print(), but there is an issue that I see with it. It seems print() allows overriding the file used for the output. It seems like input() should allow that for symmetry.

FWIW, I think your idea about making some file “readline” method more like input() is intriguing. I think I like the modification to input() better as it makes more sense to me as I can already change the file used by input, but it’s done through side effects now (i.e. setting sys.stdin to a different value). I think that removing the need for the side effect would be a good outcome. I feel like it’d at lease be more obvious what someone is doing than when I look at current use cases that redirect the stdin.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171002/9799cf51/attachment.html>

More information about the Python-ideas mailing list