2008/7/25 Suresh Pillai <[EMAIL PROTECTED]>:

> ...



> I naturally started coding with (2), but couldn't decide on the best data
> structure for python.  A set seemed ideal for speedy removal, but then I
> can't iterate through them with out popping.  An ordered list?  Some
> creative solution with numpy arrays?
>
> ...

Maybe I am missing something, but I'm not sure, where is the problem with
non-destructive iterating over a set, e.g.:
>>> my_set = set([1,2,3,4,5])
>>> my_set
set([1, 2, 3, 4, 5])
>>> for item in my_set: print item,
...
1 2 3 4 5
>>> my_set
set([1, 2, 3, 4, 5])
>>> my_set -= set([2,4])
>>> my_set
set([1, 3, 5])
>>>
Of course, the suitability for your application would depend on other
factors too.
vbr
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to