[Feature Request] dict.setdefault()

rantingrick rantingrick at gmail.com
Mon Apr 11 17:35:29 EDT 2011


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


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /