Re: Fast list traversal

2008-11-02 Thread bearophileHUGS
Steven D'Aprano: > The only solutions to that are to reduce the amount of > computation in each loop, reduce the number of items, or get a faster > computer. Changing language too is an option :-) Languages like Java, D, C, C++ may help :-) Bye, bearophile -- http://mail.python.org/mailman/listin

Re: Fast list traversal

2008-11-02 Thread Steven D'Aprano
On Sun, 02 Nov 2008 00:25:13 -0700, dineshv wrote: > I want to see if there is an alternative method for fast list traversal. > The code is very simple: > > dict_long_lists = defaultdict(list) > for long_list in dict_long_lists.itervalues() > for el

Re: Fast list traversal

2008-11-02 Thread bearophileHUGS
dineshv: > 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. Psyco can help a lot in that kind of code. >The elements of long_list are immutable (ie. don't change).< A

Re: Fast list traversal

2008-11-02 Thread dineshv
On Nov 2, 1:00 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 2 Nov 2008 00:25:13 -0700 (PDT), dineshv > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > I want to see if there is an alternative method for fast list > > tr

Fast list traversal

2008-11-02 Thread dineshv
I want to see if there is an alternative method for fast list traversal. The code is very simple: dict_long_lists = defaultdict(list) for long_list in dict_long_lists.itervalues() for element in long_list: array_a[element] = m + n + p# m,n,p are variable