On Tue, Dec 3, 2019 at 2:10 AM Serhiy Storchaka <storchaka@gmail.com> wrote:
03.12.19 07:04, Guido van Rossum пише:
> Actually there's no need to optimize the |= operator -- for strings we
> have to optimize += *because* strings are immutable, but for dicts we
> would define |= as essentially an alias for .update(), just like the
> relationship between += and .extend() for lists, and then no unnecessary
> objects would be created.

Yet one question: should |= accept only dicts at right side, or
arbitrary mappings with the keys() method, or even iterables of pairs as

IMO it should follow the example of sets, and accept Mappings but not the other thing. (If you have the other thing, use update().)
And the same question for |. Should `{} | Mapping()` and `{} | []` work?

Ditto -- {} | Mapping() should work, but {} | [] should not.

Steven, please take note -- these kinds of things should be spelled out in the PEP (apologies if they are already in there).

--Guido van Rossum (python.org/~guido)