Set Operations on Dicts

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Mon Feb 8 09:02:48 EST 2016


Matt Wheeler writes:

> On 8 February 2016 at 12:17, Jussi Piitulainen wrote:
>> Also, what would be the nicest current way to express a priority union
>> of dicts?
>>
>> { k:(d if k in d else e)[k] for k in d.keys() | e.keys() }
>
> Since Python 3.5: {**e, **d}

Thanks. I have considered this news briefly and I think I'll like it :)



More information about the Python-list mailing list