Add two dicts

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Fri Aug 29 15:01:27 CEST 2003


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
-- 
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.




More information about the Python-list mailing list