[Python-ideas] Modern language design survey for "assign and compare" statements
apalala at gmail.com
Sun May 20 14:53:46 EDT 2018
> What would be the benefit of adding the "as child_pid" syntax? The
> full assignment expression syntax completely covers all the jobs that
> you can do with a capturing if statement.
The "as" syntax over "if" and "while" may go in with all the restrictions
and caveats already discussed.
The discussion about the semantics of how ":=" should affect the enclosing
context when used in generators, etc. may continue for as long as it must.
And there are some of us who like the consistency of "us", and would shy
away from ":=".
For example, Should this be valid?
if child_pid := os.fork():
This shouldn't be:
if os.fork() as child_pid:
print(child_pid) # child_pid is undefined
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas