sam.z.ezeh@gmail.com wrote:
> I've now created a GitHub issue [2] and a draft PR [3] for
> contextlib.redirect_stdin.
To provide an update, contextlib.redirect_stdin isn't happening [1]
[1]: https://github.com/python/cpython/issues/92178#issuecomment-1115486367
__
> (Plus not-yet-existing, but hopefully soon, redirect_stdin.)
Mentioned on the redirect_stdio thread, I've now created a GitHub issue and PR
for contextlib.redirect_stdin.
> I think I want to see some examples of how and why you would use it, and
> why one couldn't just use the redirect_stdout c
> (2) I don't see `redirect_stdio(stout=None ...)` as meaning "leave
> stdout alone". I see it as equivalent to some variation of unsetting
> stdout, say setting it to /dev/null.
This makes sense, perhaps None could be an alias for a stream created from
os.devnull [1]. Then the default argument
Previously discussed here [1] [2], it was raised that the input function could
take file objects to display prompts in places other than sys.stdout and
receive input from places other than sys.stdin. Locally, the patch I have
produces the following help text:
```
Help on built-in function input
Previously raised here [1], contextlib.redirect_stdio would be a utility
function to help redirect standard input, output and error. The idea of a
function called "stdio" that does the same thing was also raised. The function
would combine the functionality of contextlib.redirect_stdout and
con