Brandt Bucher <[email protected]> added the comment:
As a somewhat simpler example:
>>> f = {False: False}
>>> z = {0: 0}
>>> f | z
{False: 0}
>>> {**f, **z}
{False: 0}
>>> f.update(z); f
{False: 0}
Though these hairier cases aren't explicitly addressed, the conflict behavior
is covered in the Rationale and Reference Implementation sections of the PEP.
All of the above examples share code (`dict_update_arg`), and that's definitely
intentional. I for one think it would be confusing (and probably a bug) if one
of the examples above gave a different key-value pair!
I find it makes more sense if you see a set as valueless keys (rather than
keyless values).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36144>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com