On Mon, May 02, 2022 at 08:23:31PM -0700, Christopher Barker wrote:
> On Mon, May 2, 2022 at 11:18 AM Steven D'Aprano
>
> > why one couldn't just use the redirect_stdout context manager.
> >
> > (Plus not-yet-existing, but hopefully soon, redirect_stdin.)
>
>
> I have no use for this but thread
On Tue, 3 May 2022 at 17:28, Serhiy Storchaka 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('Nam
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()
```
?
__
On Tue, 3 May 2022 at 11:14, Steven D'Aprano wrote:
>
> On Mon, May 02, 2022 at 07:55:16PM -, sam.z.e...@gmail.com wrote:
>
> > Using the prospective redirect_stdin context manager, the following code
> >
> > ```
> > with open("/dev/tty", 'r+') as file:
> > with contextlib.redirect_stdin(f
On Mon, May 02, 2022 at 07:55:16PM -, sam.z.e...@gmail.com wrote:
> Using the prospective redirect_stdin context manager, the following code
>
> ```
> with open("/dev/tty", 'r+') as file:
> with contextlib.redirect_stdin(file), contextlib.redirect_stdout(file):
> name = input('Nam
On Tue, 3 May 2022 at 05:56, wrote:
>
> > (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
> >
> (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
On Mon, May 02, 2022 at 05:42:12PM -, sam.z.e...@gmail.com wrote:
> input(prompt=None, /, infile=None, outfile=None)
> What do people think about this?
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 context manager.
(P