[Feature Request] dict.setdefault()

Chris Angelico rosuav at gmail.com
Tue Apr 12 00:44:53 CEST 2011

On Tue, Apr 12, 2011 at 8:41 AM, MRAB <python at mrabarnett.plus.com> wrote:
> I'm not sure that "setdefault" should take **kw args for this because
> of its existing argument structure (key + optional value).
> A new method like "updatedefault" may be better, IMHO. It would act
> like "update" except that it wouldn't overwrite existing values.

Wouldn't x.updatedefault(y) be pretty much y.update(x) ?

Chris Angelico

More information about the Python-list mailing list