Actually, after some Web search. I think, based on this: https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-augtarget that in Python you call this "augmented assignment target". The term isn't in the glossary, but so are many others.
On Sat, Jan 13, 2024 at 1:45 AM Left Right <olegsivo...@gmail.com> wrote: > > > surprising for me: > > Surprise is subjective, it's based on personal experience. Very few > languages allow arbitrary complex expressions in the same place they > allow variable introduction. The fact that "i" is not defined is > irrelevant to this example. Most programmers who haven't memorized > Python grammar by heart, but expect the language to behave similar to > the languages in the same category would be surprised this code is > valid (i.e. can be parsed), whether it results in error or not is of > no consequence. > > > There's no destructuring going on here > > I use the term "destructuring" in the same way Hyperspec uses it. > It's not a Python term. I don't know what you call the same thing in > Python. I'm not sure what you understand from it. > > On Sat, Jan 13, 2024 at 12:37 AM Greg Ewing via Python-list > <python-list@python.org> wrote: > > > > On 13/01/24 12:11 am, Left Right wrote: > > > x = [...] > > > for x[i] in x: print(i) > > > > I suspect you've misremembered something, because this doesn't > > do anything surprising for me: > > > > >>> x = [1, 2, 3] > > >>> for x[i] in x: print(i) > > ... > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > NameError: name 'i' is not defined > > > > There's no destructuring going on here, just assignment to a > > sequence item. > > > > -- > > Greg > > -- > > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list