[TriZPUG] filling lists

Joseph Mack NA3T jmack at wm7d.net
Mon Apr 6 21:49:49 CEST 2009


I'm using a list to hold a 2-D array of pixels, since AFAIK 
there are no arrays in python. My initial code assigned 
pixels in varying orders (index could be anything) but I 
soon found that

list_name.insert(index, element)

pushed all elements beyond index one slot further down the 
list. I could first use `del list_name(index)` first, but 
this is more complicated than I want (assignement would be a 
function which did a del and then insert; it would have to 
be passed the list, index and element).

I can rearrange my code to fill the list in order from 
index=0 without causing major grief.

I assume there's no simple way of doing the following 
assignement

list_name(index) = element

Is filling the list in order the usual way of handling this 
problem?

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!


More information about the TriZPUG mailing list