Apr-26-2023, 08:36 PM
(This post was last modified: Apr-26-2023, 08:36 PM by deanhystad.)
It is called a list comprehension. Run it and see what it does. Very handy things, comprehensions.
buffers = [[] for _ in indices] print(buffers)or running python from a command line.
Output:> python
Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> buffers = [[] for _ in range(3)]
>>> print(buffers)
[[], [], []]
>>> buffers[1].append(42)
>>> print(buffers)
[[], [42], []]
>>>