On Wed, Feb 05, 2014 at 12:37:01PM +0100, Santi Raffa wrote:
> How about this?
> 
> diff --git a/lib/utils/algo.py b/lib/utils/algo.py
> index a0d1fc3..2d13626 100644
> --- a/lib/utils/algo.py
> +++ b/lib/utils/algo.py
> @@ -114,13 +114,11 @@ def GetRepeatedKeys(*dicts):
>    if len(dicts) < 2:
>      return set()
> 
> -  # It is trivial to generalize this function to more than just dicts
> -  # by changing the .keys() call to another "for key in dictionary"
> -  keys = [set(dictionary.keys()) for dictionary in dicts]
> -  return set.union(*[x & y
> -                     for x in keys
> -                     for y in keys
> -                     if x is not y])
> +  keys = []
> +  for dictionary in dicts:
> +    keys.extend(dictionary)

Shouldn't this be?
  keys.extend(dictionary.keys())

Thanks,
Jose

> +
> +  return set(FindDuplicates(keys))
> 
> -- 
> Raffa Santi
> Google Germany GmbH
> Dienerstr. 12
> 80331 München
> 
> 
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores

-- 
Jose Antonio Lopes
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to