
Dec. 3, 2019
10:07 a.m.
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 dict.update()? And the same question for |. Should `{} | Mapping()` and `{} | []` work?