On Tue, 3 May 2022 at 17:28, Serhiy Storchaka <storch...@gmail.com> wrote: > > 02.05.22 22:55, sam.z.e...@gmail.com пише: > > ``` > > with open('/dev/tty', 'r+') as file: > > name = input('Name: ', infile=file, outfile=file) > > > > print(name) > > ``` > > How does it differ from just: > ``` > file.write('Name: ') > name = file.readline() > ``` > ? >
At the very least, I would expect the write to be flushed before the read happens (which wouldn't necessarily be the default when the newline is omitted, as in this case); and depending on configuration, something like GNU Readline might be active when calling input() that wouldn't be active when simply reading a line from an arbitrary file descriptor. ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FXFNYB5TCYHU3IFENIUS43ZQEQNG6M5W/ Code of Conduct: http://python.org/psf/codeofconduct/