Re:“I'm basically giving myself a permanent vacation from be...
by thomasahle on Thursday July 12, 2018 @03:07PM
(#17517635)
You mean `with EXPR as VAR` lets `VAR = EXPR.__enter__()`. Because `with EXPR` also calls `EXPR.__enter__()`, so `with VAR := EXPR` would too.
Seems very unnecessary to have both options.
Will `with` start using this syntax instead of `b as a`: `with open('foo') as a:` == `with a := open('foo'):`?
Update: found my answer on the pep. `with EXPR as VAR` actually calls `EXPR.__enter__()` so it's not the same.