On Mon, 9 May 2022 at 07:36, Jeremiah Vivian
<nohackingofkrow...@gmail.com> wrote:
>
> On Sun, 8 May 2022 at 20:52, Steven D'Aprano <st...@pearwood.info> wrote:
> > Just a quick straw poll, how would people feel about relaxing the
> > restriction on the walrus operator so that iterable unpacking is
> > allowed?
> >
> >     # Currently a syntax error.
> >     results = (1, 2, (a, b) := (3, 4), 5)
> >
> > which would create the following bindings:
> >
> >     results = (1, 2, (3, 4), 5)
> >     a = 3
> >     b = 4
>
> I've always thought of relaxing the restrictions. It's actually easy to 
> implement (even including attribute assignment/subscript assignment) and I 
> had to modify only two files (plus regenerate the parser).
>

The restrictions were never technical. They were always social - too
many people were scared that assignment expressions would lead to a
plethora of problems. (Which is not unreasonable. Guido made
assignment a statement very deliberately, back when Python was first
created. Changing that decision, or even modifying it slightly, should
indeed be thoroughly thought out.) Requiring that the target be a
simple name only was one way to minimize the risk.

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/4QHZQTA73B66GGGNVWRXM73M5OEX3GOI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to