[Python-ideas] Modern language design survey for "assign and compare" statements

Juancarlo Añez apalala at gmail.com
Sun May 20 11:19:37 EDT 2018


On Sun, May 20, 2018 at 1:35 AM, Steven D'Aprano <steve at pearwood.info>
wrote:

>
> but maybe when languages are weird enough they all look the same :-)
>

>
https://www.dreamsongs.com/WorseIsBetter.html

Look at what happened with PERL...

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.

As a reminder, some of the arguments in favor of "as" are around the
patterns exemplified by the "re" module; patterns which seem correct and
useful, and that are used by other standard and 3rd-party modules.

if os.fork() as child_pid:

    parent(child_pid)

else:

   child()




Cheers!

-- 
Juancarlo *Añez*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180520/49dbfbf9/attachment-0001.html>


More information about the Python-ideas mailing list