[Python-ideas] Inline assignments using "given" clauses
apalala at gmail.com
Sat May 12 19:36:33 EDT 2018
> LOOK similar, but are subtly different. The current 'with' statement
> doesn't create a subscope; the only "context" it creates is regarding
> the resource represented by the context manager. For instance, opening
> a file in a 'with' block will close the file at the end of the block -
> but you still have a (closed) file object. Using "with... as" for name
> bindings wouldn't call __enter__ or __exit__, so it won't create that
> kind of context; and whether it creates a subscope for the variable or
> not, it's not going to match the 'with' statement.
That is all valid, but it still would be familiar, and easier to explain.
Python already uses "in", which is used in other languages to introduce
The statement structure of "with...as" seems desirable, just asking for a
word that is not "with" or "given". I don't remember if "when" was already
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas