This is something I tried out in ipython
the behavior is quite clear: when creating the dictionary in lines 3 and 6, the dictionaries are created as if invoked by dict(**kwargs)
and the kwargs are being processed left to right but is it a CPython implementation or is the behavior actually specified in Python s grammar?
Python 3.12.2 (v3.12.2:6abddd9f6a, Feb 6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)]
Type copyright , credits or license for more information
IPython 8.22.2 -- An enhanced Interactive Python. Type ? for help.
In [1]: x={"a":1, "b":2, "c":4}
In [2]: y= dict(z=x.pop("b"), **x)
In [3]: y
Out[3]: { z : 2, a : 1, c : 4}
In [4]: x
Out[4]: { a : 1, c : 4}
In [5]: x={"a":1, "b":2, "c":4}
In [6]: y= dict(**x, z=x.pop("b") )
In [7]: y
Out[7]: { a : 1, b : 2, c : 4, z : 2}
In [8]: x
Out[8]: { a : 1, c : 4}