[Python-ideas] Inline assignments using "given" clauses
Juancarlo Añez
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
context.
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
rejected.
http://www.thesaurus.com/browse/with?s=t
http://www.thesaurus.com/browse/given?s=t
http://www.thesaurus.com/browse/considering?s=t
http://www.thesaurus.com/browse/assume?s=t
http://www.thesaurus.com/browse/when?s=t
Cheers!
--
Juancarlo *Añez*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180512/3bc8f7a6/attachment-0001.html>
More information about the Python-ideas
mailing list