I simply want to create an empty 10*3*2 array with Python.
I first thought of these one, but this is not working:
parameters = [ [ [] * 2 ]*3 ] * 10
this gives me a vector of ten vectors, with three [] elements in it:
[[[], [], []], [[], [], []], [[], [], []], [[], [], []], [[], [], []],
[[], [], []], [[], [], []], [[], [], []], [[], [], []], [[], [], []]]
that is , if I want to access parameters[0][0][1] I am out of bounds, whereas I want a dimension 2 for the innermost vectors along the third dimension.
then I thought of this
[ [ [[] * 2] ]*3 ] * 10
I was thinking that [[] * 2]
would now bring me the thing I want, an innermost two elements vector. I obtain
[[[[]], [[]], [[]]], [[[]], [[]], [[]]], [[[]], [[]], [[]]],
[[[]], [[]], [[]]], [[[]], [[]], [[]]], [[[]], [[]], [[]]],
[[[]], [[]], [[]]], [[[]], [[]], [[]]], [[[]], [[]], [[]]], [[[]], [[]], [[]]]]
So, how to do it, or how to escape this initialization?
Kd rgds.