osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Accepting PEP 572, Assignment Expressions


Also nobody had a use case.

On Fri, Jul 13, 2018 at 6:57 AM Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Jul 13, 2018 at 11:36 PM, Random832 <random832 at fastmail.com>
> wrote:
> > On Wed, Jul 11, 2018, at 20:10, Guido van Rossum wrote:
> >> As anticippated, after a final round of feedback I am hereby accepting
> PEP
> >> 572, Assignment Expressions: https://www.python.org/dev/peps/pep-0572/
> >
> > I know everyone else is probably sick of discussing this (I somehow
> completely missed the discussion until it was almost done) but I have a
> question...
> >
> > Why does this not allow assignment to attributes and subscripts? I think
> this is, at least, surprising enough that there should be a rationale
> section explaining it in the PEP. As it is, it's barely even explicitly
> stated, other than the use of 'NAME' in a few places and an offhand mention
> "and [the assignment statement] can assign to attributes and subscripts."
> >
>
> It was discussed at some length, yes. Assignment to arbitrary targets
> would also mean permitting iterable unpacking, which is not desired
> ("x, y := 3, 4"??), and there weren't enough use-cases for
> attribute/item assignment to justify creating a rule of "you can
> assign to any single target, but can't unpack". In the future, if such
> use-cases are found, the grammar can be expanded.
>
> 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 (mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180713/9ec5424b/attachment.html>