S
Suresh Pillai
Since I am doing A LOT of loops over the nodes and the number of nodes
is also huge, my concern using sets is that in order to iterate over the
set in each step of my simulation, the set items need to be converted to
a list every time. So while removal from a set is much cheaper than say
from a list, what about this conversion overhead in order to iterate
over the items.
I could of course use the old trick of using a dictionary with 'None'
values and then using iterkeys(). But I thought sets were supposed to
replace this. So maybe I should be asking a more basic question: is
there any way to iterate over the items in a set other than converting to
a list or using the pop() method.