I have seen a quick way to create a array/lists using for loops in this form
M = [[x,i,j] for i range(n) for j in range (m) if <condition> ]
In this case, the code creates an array M
(if there is no "condition" specified)
M = [[x,0,0],...[x,0,m],[x,1,0],...,[x,n,m]]
I want to add complicated conditions on i
and j
. What is the general syntax for using this method? Where can I find more documentation?