[Feature Request] dict.setdefault()

Westley Martínez anikom15 at gmail.com
Mon Apr 11 18:16:47 EDT 2011


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




More information about the Python-list mailing list