Python 3.15 list unpacking: Flattening a nested list

Python 3.15 list unpacking: Flattening a nested list

Want to unroll a nested list in Python 3.15?

x = [[10, 20, 30], [40, 50, 60], [70, 80]]

Use a nested list comprehension:

[n
 for sublist in x
 for n in sublist]

Or use the new unpacking syntax:

[*n for n in x] # same thing!