matrix = [[j for j in range(5)] for i in range(5)]
>>> A=[[1,2,3], [4,5,6], [7,8] , [9,10]] # A is a list of lists
>>> [x for y in A for x in y] # dissolves the inner brackets
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>>
[f(a,b,c) for a, b in iterable_1 if condition for c in iterable_2]
# Nested list comprehension
nested_list = [[_ + __ for _ in range(5)] for __ in range(3)]
print(nested_list)
[[0, 1, 2, 3, 4], [1, 2, 3, 4, 5], [2, 3, 4, 5, 6]]