On Mon, Mar 26, 2018 at 11:14:43AM +0300, Kirill Balunov wrote:
> Hi Chris, would you mind to add this syntactic form `(expr -> var)` to
> alternative syntax section, with the same semantics as `(expr as var)`. It
> seems to me that I've seen this form previously in some thread (can't find
> where), but it does not appear in alt. syntax section.

That was probably my response to Nick:

https://mail.python.org/pipermail/python-ideas/2018-March/049472.html

I compared four possible choices:

    target = default if (expression as name) is None else name
    target = default if (name := expression) is None else name
    target = default if (expression -> name) is None else name
    target = default if (name <- expression) is None else name


The two arrow assignment operators <- and -> are both taken from R.

If we go down the sublocal scope path, which I'm not too keen on, then 
Nick's earlier comments convince me that we should avoid "as". In that 
case, my preferences are:

   (best)  ->  :=  <-  as  (worst)

If we just bind to regular locals, then my preferences are:

   (best)  as  ->  :=  <-  (worst)

Preferences are subject to change :-)




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