Optimize function similiar to dict.update() but adds common values
gregpinero at gmail.com
Wed Dec 14 19:17:12 CET 2005
Yes, that makes sense. I can't wait to run it tonight. Sorry I can't
give you the running time of my original function as it never finished
I'll report back the running time of the new function though, assuming
it finishes ;-)
On 12/14/05, Peter Otten <__peter__ at web.de> wrote:
> Gregory Piñero wrote:
> > Here's a question about your functions. if I only look at the keys in
> > freq2 then won't I miss any keys that are in freq1 and not in freq2?
> No. As I start with a copy of freq1, all keys of freq1 are already there.
> There is probably a loop involved, but it in Python's underlying C
> implementation, which is a bit faster.
> What is left to do is to (1) add key and value for the 20% of freq2 that are
> not in freq1, and to (2) increase the value for the 80% where the key
> occurs in both freq1 and freq2. This is done by the for-loop.
Chief Innovation Officer
More information about the Python-list