[Python-ideas] PEP: Dict addition and subtraction
skrah at bytereef.org
Sat Mar 16 05:38:59 EDT 2019
On Sat, Mar 16, 2019 at 09:04:22PM +1300, Greg Ewing wrote:
> Another random thought about this: Mathematicians use addition as a
> metaphor for quite a range of different things, but they tend to only
> use the symbols ∪ and ∩ for actual sets, or things that are very
> set-like. So maybe that's an argument for using '+' rather than '|'
> for dict merging.
If one views an ordered dict as an assoc list, '+' would mean prepending
the new values to the existing ones.
If one views an unordered dict as a set of ordered pairs, '|' would make
More information about the Python-ideas