On Mon, May 21, 2018 at 1:19 AM, Juancarlo Añez <apal...@gmail.com> wrote:
> IMPORTANT NOTE:
>
> Enabling "as" in "if" and "while"  doesn't have to be at the expense of some
> form of assignment expression. We've been having this discussion as if has
> to be either one or the other, and there's no reason we can't have both (as
> mentioned before, "reduce()"  is live and well in the libraries, for people
> who need to use it).
>
> I in particular would not like it at all if something like ":="  was at the
> expense of "as", and I think that others on the side of expanding "if" and
> "while" may feel the same way.

Let's suppose that the := syntax already existed in Python - that you
could write this:

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

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.

ChrisA
_______________________________________________
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