On 5/18/2019 8:13 PM, Yonatan Zunger wrote:
...
For example, this is a good pattern:
with functionReturningFile(...) as input:
doSomething(input)
There are many cases where an Optional[file] makes sense as a parameter,
as well; for example, an optional debug output stream, or an input
sou
On 5/19/2019 3:00 PM, Chris Angelico wrote:
On Mon, May 20, 2019 at 4:46 AM Terry Reedy wrote:
On 5/18/2019 10:01 PM, Chris Angelico wrote:
2) Redefine the 'with' block or create a new syntactic form such that
the variable actually creates a subscope. That way, at the end of the
block, the n
On Mon, May 20, 2019 at 4:46 AM Terry Reedy wrote:
>
> On 5/18/2019 10:01 PM, Chris Angelico wrote:
>
> > 2) Redefine the 'with' block or create a new syntactic form such that
> > the variable actually creates a subscope. That way, at the end of the
> > block, the name would revert to its former m
On 5/18/2019 10:01 PM, Chris Angelico wrote:
2) Redefine the 'with' block or create a new syntactic form such that
the variable actually creates a subscope. That way, at the end of the
block, the name would revert to its former meaning.
x = 1
with local 2 as x:
print(x) # 2
print(x) # 1
On 5/18/2019 10:44 PM, Yonatan Zunger wrote:
Terry, let me make sure I'm understanding your responses.
(1) Only certain things should be CM's, and those things should be
explicitly denoted as such.
Thinking about the first one, the purpose of the context manager
protocol is to allow cleanup