Wednesday, July 30, 2008

Python: Multi-dimensional dynamic arrays

Another very poorly documented topic is how to create dynamic arrays of type array. Every second website will show you how to create static 2D arrays, which is pretty much useless for 90% of the practical applications out there.

I 'solved' it to a degree by creating a list of array items, but this is still not ideal. I would like to use a pure multi-deminsional array of type array.

Here's how I did it:
multi_arr = []

for i in range(some_range):
arr = array('f') # array of type float

# ... populate arr ...


No comments: