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

Reply via email to