> 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():
    parent(child_pid)
else:
   child()

print(child_pid)


This shouldn't be:

if os.fork() as child_pid:
    parent(child_pid)
else:
   child()

print(child_pid)  # child_pid is undefined

-- 
Juancarlo *Añez*
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to