Add two dicts

Michele Simionato mis6 at pitt.edu
Fri Aug 29 21:17:18 CEST 2003


Christos "TZOTZIOY" Georgiou <tzot at sil-tec.gr> wrote in message news:<mejukv8soj1phieta0k3gl2n2v9lucvjde at 4ax.com>...
> On 29 Aug 2003 05:40:15 -0700, rumours say that mis6 at pitt.edu (Michele
> Simionato) might have written:
> 
> [snip]
> 
> >    def __add__(self,other):
> >        self.update(other)
> >        return self.__class__(self)
> 
> hm... I am not sure about this; it's not iadd, so you shouldn't modify
> self.
> 
> Perhaps you should (untested):
>     def __add__(self, other):
>         temp = self.copy()
>         temp.update(other)
>         return temp

As you wish ;)

Michele Simionato, Ph. D.
MicheleSimionato at libero.it
http://www.phyast.pitt.edu/~micheles
--- Currently looking for a job ---




More information about the Python-list mailing list