[Python-ideas] adding dictionaries

Alexander Heger python at 2sn.net
Tue Jul 29 02:38:38 CEST 2014


>  > It seems it would be valuable to parallel the behaviour of operators
>  > already in place for collections.
>
> Mappings aren't collections.  In set theory, of course, they are
> represented as *appropriately restricted* collections, but the meaning
> of "+" as applied to mappings in mathematics varies.  For functions on
> the same domain, there's usually an element-wise meaning that's
> applied.  For functions on different domains, I've seen it used to
> mean "apply the appropriate function on the disjoint union of the
> domains".
>
> I don't think there's an obvious winner in the competition among the
> various meanings.

I mistyped.  It should have read " ... the behaviour in place for
collections.Counter"

It does define "+" and "|" operations.

-Alexander


More information about the Python-ideas mailing list