I want to see if there is an alternative method for fast list
traversal. The code is very simple:
dict_long_lists = defaultdict(lis t)
for long_list in dict_long_lists .itervalues()
for element in long_list:
array_a[element] = m + n + p # m,n,p
are variable numbers
The long_list's are read from a defaultdict(lis t) dictionary and so
don't need initializing. The elements of long_list are integers and
ordered (sorted before placing in dictionary). There are 20,000
long_list's each with a variable number of elements (>5,000). The
elements of long_list are immutable (ie. don't change). The above
code is within a def function.
I've tried set() using defaultdict(set ) but the elements are not
ordered.
What is the fastest way to traverse these long_list's sequentially
from the beginning to the end? Maybe there is another data structure
that can be used instead of a list.
Dinesh
traversal. The code is very simple:
dict_long_lists = defaultdict(lis t)
for long_list in dict_long_lists .itervalues()
for element in long_list:
array_a[element] = m + n + p # m,n,p
are variable numbers
The long_list's are read from a defaultdict(lis t) dictionary and so
don't need initializing. The elements of long_list are integers and
ordered (sorted before placing in dictionary). There are 20,000
long_list's each with a variable number of elements (>5,000). The
elements of long_list are immutable (ie. don't change). The above
code is within a def function.
I've tried set() using defaultdict(set ) but the elements are not
ordered.
What is the fastest way to traverse these long_list's sequentially
from the beginning to the end? Maybe there is another data structure
that can be used instead of a list.
Dinesh
Comment