On Sat, Feb 6, 2021 at 8:54 PM Paul Sokolovsky <pmis...@gmail.com> wrote:
>
> Hello,
>
> On Sat, 6 Feb 2021 17:26:00 +1100
> Chris Angelico <ros...@gmail.com> wrote:
>
> > On Sat, Feb 6, 2021 at 5:21 PM Random832 <random...@fastmail.com>
> > wrote:
> > >
> > > While we're on the subject of assignment expression limitations,
> > > I've occasionally wanted to write something like
> > >
> > > try:
> > >     return a_dict[key]
> > > except KeyError:
> > >     return (a_dict[key] := expression to construct value)
> >
> > That's what the __missing__ method is for.
>
> That's true, but that would be an argument against PEP572 ;-).

PEP 572 was never meant to replace all other ways of doing things, and
__missing__ is exactly the tool for this job :)

> But we live in a world where PEP572 is a reality, and people start to
> look how to get the most juice out of it.

Why? Just because it's there?

> While triaging the issue with parallel assignments, I saw there's
> already pretty long trail of elaboration of ":=" for various cases where
> original implementation forced parens, which were looking weird to
> human eye, e.g.:
>
> https://bugs.python.org/issue42316
> https://bugs.python.org/issue42374
> https://bugs.python.org/issue42381
>
> My proposal is to file parallel assignment case into the same "inital
> omission" department like the above. And just like the above, it seems
> it would be a trivial grammar fix (I didn't run the whole testsuite on
> the result yet though ;-) ).

The omission was intentional, and so far, I'm not seeing a
justification for reversing that decision :)

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UJ2GKZUS7FBYR3KDWCLC6ENVHSWGW6XZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to