Author ezio.melotti
Recipients QuantumTim, alexandre.vassalotti, benjamin.peterson, exarkun, ezio.melotti, hotdog003, loewis
Date 2009-07-04.23:51:47
SpamBayes Score 9.14593e-08
Marked as misclassified No
Message-id <1246751509.28.0.477656045784.issue6410@psf.upfronthosting.co.za>
In-reply-to
Content
A dict.merge() method could be added so that:

>>> a = dict(x=10, y=20)
>>> b = dict(y=30, z=40)
>>> a.merge(b)
dict(x=10, y=20, z=40)
>>> b.merge(a)
dict(y=30, z=40, x=10)

In case of duplicate keys, the items of the second dict with the same
keys will be discarded (even if dict.update() does the opposite, I think
here it make more sense in this way).

I never needed to do something like this though, so I'm +0 about it.
History
Date User Action Args
2009-07-04 23:51:49ezio.melottisetrecipients: + ezio.melotti, loewis, exarkun, alexandre.vassalotti, QuantumTim, benjamin.peterson, hotdog003
2009-07-04 23:51:49ezio.melottisetmessageid: <1246751509.28.0.477656045784.issue6410@psf.upfronthosting.co.za>
2009-07-04 23:51:47ezio.melottilinkissue6410 messages
2009-07-04 23:51:47ezio.melotticreate