On Tue, 16 Jun 2026 at 01:45, Jon Ribbens via Python-list <[email protected]> wrote: > My biggest complaint about := is the arbitrary and mysterious > restrictions on what you can use on the left hand side. You can't > even say "a.b := c". The PEP that introduced ":=" barely even > mentions these restrictions, let alone discusses or explains them.
Perhaps it isn't obvious, but here's the part of the specification that you're referring to: https://peps.python.org/pep-0572/#syntax-and-semantics "NAME is an identifier". It is that simple. It's not arbitrary or mysterious. The rule is that the target must be an identifier. Nothing more, nothing less. As to why, that's largely to avoid syntactic ambiguities, although even so, certain usages with lambda functions require parentheses. But hey, if *that's* your biggest complaint, I'm glad it was so easy to answer! ChrisA -- https://mail.python.org/mailman3//lists/python-list.python.org
