4 ms·
This is a small but welcome change. Note that the two new operators introduced for dict a | b a |= b brings the behavior in line with the same operators
by divbzero 7y ago
This is a small but welcome change.
Note that the two new operators introduced for dict
a | b
a |= b
brings the behavior in line with the same operators for set. [1]
[1]: https://docs.python.org/3.8/library/stdtypes.html#set-types-set-frozenset https://docs.python.org/3.8/library/stdtypes.html#set-types-...
- BerislavLopac 7y agoI have always found dicts and sets being pretty much basically the same thing, with dicts allowing for "attaching" additional values to the set items. In fact, before sets were introduced (in Python 2.3), using dicts (with elements for keys and some arbitrary values -- commonly None -- for values) was a common way to emulate them.