[Python-ideas] Allow using ** twice
Oscar Benjamin
oscar.j.benjamin at gmail.com
Thu Jun 6 17:11:51 CEST 2013
On 6 June 2013 16:08, Zachary Ware <zachary.ware+pyideas at gmail.com> wrote:
>> However you can make a class that will try several mappings sequentially e.g.:
>
> That sounds rather like collections.ChainMap.
So it does. Thanks for pointing this out; I wasn't aware of it. So as
of PYthon 3.3 you can do:
from collections import ChainMap
func(**ChainMap(dict1, dict2))
Although this does not have the behaviour suggested by the OP (an
error when a key is duplicated).
Oscar
More information about the Python-ideas
mailing list