On Tue, 3 May 2022 at 17:28, Serhiy Storchaka <[email protected]> wrote: > > 02.05.22 22:55, [email protected] пише: > > ``` > > 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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/FXFNYB5TCYHU3IFENIUS43ZQEQNG6M5W/ Code of Conduct: http://python.org/psf/codeofconduct/
