[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you Peter!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset bee66d3cb98e740f9d8057eb7f503122052ca5d8 by Miss Islington (bot) 
in branch '3.9':
bpo-41147: [doc] contextlib.redirect_stdout() provides the new stream as 
context var (GH-21199) (GH-26380)
https://github.com/python/cpython/commit/bee66d3cb98e740f9d8057eb7f503122052ca5d8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 1261941e02cd04829592b1b1360b4ec21bfcdb9a by Miss Islington (bot) 
in branch '3.10':
bpo-41147: [doc] contextlib.redirect_stdout() provides the new stream as 
context var (GH-21199) (GH-26379)
https://github.com/python/cpython/commit/1261941e02cd04829592b1b1360b4ec21bfcdb9a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 46db39d7bd67fb9fea133cd4f18cdf7eacb0f6d9 by Peter Law in branch 
'main':
bpo-41147: [doc] contextlib.redirect_stdout() provides the new stream as 
context var (GH-21199)
https://github.com/python/cpython/commit/46db39d7bd67fb9fea133cd4f18cdf7eacb0f6d9


--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24972
pull_request: https://github.com/python/cpython/pull/26380

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2021-05-26 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +24971
pull_request: https://github.com/python/cpython/pull/26379

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2020-06-28 Thread Peter Law


Change by Peter Law :


--
keywords: +patch
pull_requests: +20352
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21199

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2020-06-28 Thread Peter Law


New submission from Peter Law :

In `contextlib`, `_RedirectStream` (the class behind `redirect_stdout` and 
`redirect_stderr`) returns the current stream target as its context variable, 
which allows code like this:

``` python
with redirect_stdout(io.StringIO()) as buffer:
do_stuff()

use(buffer.getvalue())
```

where you capture the redirected stream without a separate line to declare the 
variable.

This isn't documented (See 
https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stdout), 
yet is potentially useful.

Unless there's a reason that this isn't documented, I propose that the 
documentation be modified to include it.

Aside: After initially reporting this against the typeshed 
(https://github.com/python/typeshed/issues/4283) I'm also working on a PR to 
the typeshed to include this there.

--
assignee: docs@python
components: Documentation
messages: 372513
nosy: PeterJCLaw, docs@python
priority: normal
severity: normal
status: open
title: Document that redirect_std{out,err} yield the new stream as the context 
variable
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com