2 ms·
Not true, it's part of Python's syntax. Here it is in Pypy: Python 2.5.2 (79560, Nov 26 2010, 14:57:55) [PyPy 1.4.0] on win32 >>> a = [1, 2 ,3] >>>
by cool-RR 16y ago
Not true, it's part of Python's syntax. Here it is in Pypy:
Python 2.5.2 (79560, Nov 26 2010, 14:57:55)
[PyPy 1.4.0] on win32
>>> a = [1, 2 ,3]
>>> for a[:] in [[6, 7, 8]]:
... pass
>>> print(a)
[6, 7, 8]
- StavrosK 16y agoSo what does it do? Run the expression first and assign to whatever's there? It seems that it would only work to assign to a slice, as anything else would be overwritten, but why?