[TriZPUG] filling lists

Chris Rossi chris at christophermrossi.com
Mon Apr 6 22:01:49 CEST 2009

list_name[index] = element


On Mon, Apr 6, 2009 at 3:49 PM, Joseph Mack NA3T <jmack at wm7d.net> wrote:

> 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!
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> http://mail.python.org/mailman/listinfo/trizpug
> http://trizpug.org is the Triangle Zope and Python Users Group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20090406/836df4f3/attachment.htm>

More information about the TriZPUG mailing list