fast pythonic algorithm question

2006-08-01 Thread Guyon Morée
hi all, i have a big list of tuples like this: [ (host, port, protocol, startime, endtime), .. ] etc now i have another big(ger) list of tuples like this: [(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc now i need to find all the items in the second list where either

Re: fast pythonic algorithm question

2006-08-01 Thread Paul Rubin
Guyon Morée [EMAIL PROTECTED] writes: if (((src_host,src_port, protocol) in dict or (dest_host, dest_port, protocol) in dict) and starttime time endtime): print we have a winner If you have enough memory to do it that way, what's the problem? --

Re: fast pythonic algorithm question

2006-08-01 Thread Guyon Morée
Memory is no problem. It just needs to be as fast as possible, if that's what this is, fine. If not, I'd like to find out what is :) thanx, Guyon Moree http://gumuz.looze.net Paul Rubin schreef: Guyon Morée [EMAIL PROTECTED] writes: if (((src_host,src_port, protocol) in dict or

Re: fast pythonic algorithm question

2006-08-01 Thread Diez B. Roggisch
Guyon Morée wrote: Memory is no problem. It just needs to be as fast as possible, if that's what this is, fine. If not, I'd like to find out what is :) I'd say it is as fast as it can get - using hashing for lookups is O(n) in most cases, where bisection or other order-based lookups have

Re: fast pythonic algorithm question

2006-08-01 Thread David Reed
On Aug 1, 2006, at 11:13 AM, Diez B. Roggisch wrote: Guyon Morée wrote: Memory is no problem. It just needs to be as fast as possible, if that's what this is, fine. If not, I'd like to find out what is :) I'd say it is as fast as it can get - using hashing for lookups is O (n) in I

Re: fast pythonic algorithm question

2006-08-01 Thread Diez B. Roggisch
I'd say it is as fast as it can get - using hashing for lookups is O (n) in I know you meant O(1) for hash lookups, but just in case anyone is confused, I figured I'd correct this. Ooops. Thanks. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: fast pythonic algorithm question

2006-08-01 Thread bryanjugglercryptographer
Guyon Morée wrote: i have a big list of tuples like this: [ (host, port, protocol, startime, endtime), .. ] etc now i have another big(ger) list of tuples like this: [(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc now i need to find all the items in the second list

Re: fast pythonic algorithm question

2006-08-01 Thread Guyon Morée
Brian you are right, but in my case (host, port, protocol) is unique. [EMAIL PROTECTED] schreef: Guyon Morée wrote: i have a big list of tuples like this: [ (host, port, protocol, startime, endtime), .. ] etc now i have another big(ger) list of tuples like this: [(src_host,