[Python-Dev] PEP 572: Assignment Expressions

Guido van Rossum guido at python.org
Fri Apr 20 16:59:47 EDT 2018


Does the PEP currently propose to *allow* that horrible example? I thought
Tim Peters successfully pleaded to *only* allow a single "NAME := <expr>".
You don't have to implement this restriction -- we know it's possible to
implement, and if specifying this alone were to pull enough people from -1
to +0 there's a lot of hope!

On Fri, Apr 20, 2018 at 1:12 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, Apr 21, 2018 at 6:04 AM, David Mertz <mertz at gnosis.cx> wrote:
> > It's horrors like this:
> >
> >     g(items[idx] := idx := f())
> >
> > That make me maybe +0 if the PEP only allowed simple name targets, but
> > decisively -1 for any assignment target in the current PEP.
>
> But that's my point: you shouldn't need to write that. Can anyone give
> me a situation where that kind of construct is actually useful? Much
> more common would be to use := inside the square brackets, which makes
> the whole thing a lot more sane.
>
> You can ALWAYS write stupid code. Nobody can or will stop you.
>
> ChrisA
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180420/442d4824/attachment.html>


More information about the Python-Dev mailing list