dict.setdefault()

rantingrick rantingrick at gmail.com
Mon Apr 11 22:58:15 EDT 2011


On Apr 11, 5:41 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:

> A new method like "updatedefault" may be better, IMHO. It would act
> like "update" except that it wouldn't overwrite existing values.

That's sounds good MRAB! After you mentioned this i had an epiphany...
why not just add an extra argument to dict.update?

>>> dict.update(D, clobberexistingkeys=False)



More information about the Python-list mailing list