4 ms·
Fwiw, I find creating a 2d array and then flattening (`itertools.chain.from_iterable([[None for _y in range(y)] for _x in range(x)])` to be both readable and re
by joshuamorton 6y ago
Fwiw, I find creating a 2d array and then flattening (`itertools.chain.from_iterable([[None for _y in range(y)] for _x in range(x)])` to be both readable and reasonably concise, though yes explicit loops are also fine.
- cat199 6y agonice trick.. though if you are relying on the 'generator' aspect of comprehensions this may be problematic (will create in-memory copies)