Re: [Python-ideas] Proposal: Allowing any variable to be used in a 'with... as...' expression

2019-05-20 Thread Stephen J. Turnbull
Chris Angelico writes: > 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 > > >

Re: [Python-ideas] Proposal: Allowing any variable to be used in a 'with... as...' expression

2019-05-20 Thread Stephen J. Turnbull
Robert Collins writes: > What you describe sounds like the Maybe monad or the Option enum in > Rust to me. > > with Maybe(expr1) as var1, expr2 as var2, ...: > body > > doesn't seem ugly to me, and would make clear whether expr1 was > something that had to have a value or could, mayb