[Python-ideas] adding dictionaries
Stephen J. Turnbull
stephen at xemacs.org
Tue Jul 29 07:15:44 CEST 2014
Terry Reedy writes:
> This assumes the same range set (of addable items) also. If Python were
> to add d1 + d2 and d1 += d2, I think we should use this existing and
> most common definition and add values.
IMHO[1] that's way too special for the generic mapping types. If one
wants such operations, she should define NumericValuedMapping and
StringValuedMapping etc classes for each additive set of values.
> > For functions on different domains, I've seen it used to
> > mean "apply the appropriate function on the disjoint union of the
> > domains".
>
> According to https://en.wikipedia.org/wiki/Disjoint_union, d_u has at
> least two meaning.
Either meaning will do here, with the distinction that the set-
theoretic meaning (which I intended) applies to any two functions,
while the alternate meaning imposes a restriction on the functions
that can be added (and therefore is inappropriate for this discussion
IMHO).
Footnotes:
[1] I mean the "H", I'm no authority.
More information about the Python-ideas
mailing list