<div dir="ltr"><div><div>Hello,<br><br></div><div>it seems that there are two independent issues – a way to temporarily replace all sys.std* streams, and a way to use the special interactive readline logic for arbitrary terminal-like file. I thought that OP's concern was the latter. In that case shouldn't there just be a way to produce an IO object f whose 
.readline() (or other special method) does this and has an optional 
prompt argument? The OP's code would become<br></div><br></div><div>with open_terminal('/dev/tty') as f:<br>    name = f.readline(prompt='Name? ')<br><br>It seems to me that changing the rather specialized input() function is 
wrong in both cases. For me input() is just a short way to read from the
 standard input, usually interactively – the same way print is a short 
way to write to the standard output. IIRC there was even proposal to 
remove input() in favor of direct use of sys.stdin.readline() at time of
 Python 3000 redesign.<br><br></div>Regards, Adam Bartoš<br><br></div>