Re: Today's fun and educational Python recipe

2011-05-05 Thread nn
On May 4, 2:17 pm, Raymond Hettinger pyt...@rcn.com wrote: Here's a 22-line beauty for a classic and amazing algorithm:http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written:http://en.wikipedia.org/wiki/Bloom_filter It turns out that people in the 1970's

Today's fun and educational Python recipe

2011-05-04 Thread Raymond Hettinger
Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written: http://en.wikipedia.org/wiki/Bloom_filter It turns out that people in the 1970's were pretty smart :-) Raymond --- follow my other python

Re: Today's fun and educational Python recipe

2011-05-04 Thread Irmen de Jong
On 04-05-11 20:17, Raymond Hettinger wrote: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written: http://en.wikipedia.org/wiki/Bloom_filter It turns out that people in the 1970's were pretty smart

Re: Today's fun and educational Python recipe

2011-05-04 Thread Raymond Hettinger
It turns out that people in the 1970's were pretty smart :-) I think that often, the cleverness of people is inversely proportional to the amount of CPU power and RAM that they have in their computer. The Google guys have plenty of CPU power *and* plenty of cleverness :-) According to the

Re: Today's fun and educational Python recipe

2011-05-04 Thread Grant Edwards
On 2011-05-04, Irmen de Jong ir...@-nospam-xs4all.nl wrote: On 04-05-11 20:17, Raymond Hettinger wrote: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written:

Re: Today's fun and educational Python recipe

2011-05-04 Thread Paul Rubin
Raymond Hettinger pyt...@rcn.com writes: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The use of pickle to serialize the keys is a little bit suspicious if there might be a reason to dump the filter to disk and re-use it in another run of the program.

Re: Today's fun and educational Python recipe

2011-05-04 Thread Irmen de Jong
On 04-05-11 21:13, Raymond Hettinger wrote: It turns out that people in the 1970's were pretty smart :-) I think that often, the cleverness of people is inversely proportional to the amount of CPU power and RAM that they have in their computer. The Google guys have plenty of CPU power *and*

Re: Today's fun and educational Python recipe

2011-05-04 Thread Terry Reedy
On 5/4/2011 2:17 PM, Raymond Hettinger wrote: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written: http://en.wikipedia.org/wiki/Bloom_filter As I understand the article, the array of num_bits

Re: Today's fun and educational Python recipe

2011-05-04 Thread Raymond Hettinger
On May 4, 12:42 pm, Terry Reedy tjre...@udel.edu wrote: On 5/4/2011 2:17 PM, Raymond Hettinger wrote: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The wiki article on the algorithm is brief and well-written:

Re: Today's fun and educational Python recipe

2011-05-04 Thread Raymond Hettinger
On May 4, 12:27 pm, Paul Rubin no.em...@nospam.invalid wrote: Raymond Hettinger pyt...@rcn.com writes: Here's a 22-line beauty for a classic and amazing algorithm: http://bit.ly/bloom_filter The use of pickle to serialize the keys is a little bit suspicious if there might be a reason to

Re: Today's fun and educational Python recipe

2011-05-04 Thread Ben Finney
Grant Edwards invalid@invalid.invalid writes: On 2011-05-04, Irmen de Jong ir...@-nospam-xs4all.nl wrote: I think that often, the cleverness of people is inversely proportional to the amount of CPU power and RAM that they have in their computer. True. Unfortunately the difficulty in

Re: Today's fun and educational Python recipe

2011-05-04 Thread Terry Reedy
On 5/4/2011 5:39 PM, Raymond Hettinger wrote: The 512 bits in h are progressively eaten-up between iterations. So each pass yields a different (array index, bit_mask) pair. Yeh, obvious now that I see it. It's easy to use the interactive prompt to show that different probes are produced on

Re: Today's fun and educational Python recipe

2011-05-04 Thread Raymond Hettinger
On May 4, 5:26 pm, Terry Reedy tjre...@udel.edu wrote: The test would be more convincing to many with 10 other geographic names (hard to come by, I know), or other english names or words or even with longer random strings that matched the lengths of the state names. But an average of

Re: Today's fun and educational Python recipe

2011-05-04 Thread Chris Angelico
On Thu, May 5, 2011 at 5:02 AM, Irmen de Jong ir...@-nospam-xs4all.nl wrote: I think that often, the cleverness of people is inversely proportional to the amount of CPU power and RAM that they have in their computer. As Mark Rosewater is fond of saying, restrictions breed creativity. Lack of