[Python-ideas] Allow using ** twice

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Jun 6 17:08:07 CEST 2013


On 6 June 2013 16:02, MRAB <python at mrabarnett.plus.com> wrote:
> For example:
>
>     temp = dict1 | dict2
>
> would have the same result as:
>
>     temp = {}
>     temp.update(dict1)
>     temp.update(dict2)

I would expect this to have the reverse order e.g.:

     temp = {}
     temp.update(dict2)
     temp.update(dict1)

I read `dict1 | dict2` as a mapping that would try dict1 *or* dict2 if
the key is not in dict1.


Oscar


More information about the Python-ideas mailing list