On 11/04/2011 23:16, Westley Martínez wrote:
On Mon, 2011-04-11 at 14:35 -0700, rantingrick wrote:
setdefault should take **kw args in the case of needing to set
multiple defaults at one time. I would even settle for an *arg list if
i had to. Anything is better than...

d.setdefault(blah, blah)
d.setdefault(blah, blah)
d.setdefault(blah, blah)
d.setdefault(blah, blah)
if blah is not blah:
     d.setdefault(blah, blah)

...nuff said.

PS: And to counter the very *extemely* likely chance of some smart
arse responses
   * YES, i know i could create my own setdefault method but that is
not the point.
   * I know we are under the moratorium but someone had to mention it,

--rr

Go to bugs.python.org

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.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to