[Python-ideas] Implementing a set of operation (+, /, - *) on dict consistent with linearAlgebrae
Vladimir Filipović
hemflit at gmail.com
Wed Oct 31 13:35:09 EDT 2018
Julien, would I be correct if I summarized the changes you have in
mind like this:
for dictionaries d1 and d2,
non-Mapping ("scalar") sc,
binary operation ⊛,
and unary operation 𝓊 (such as negation or abs()):
d1 ⊛ sc == {k: (v ⊛ sc) for k, v in d1.items()}
sc ⊛ d1 == {k: (sc ⊛ v) for k, v in d1.items()}
𝓊(d1) == {k: 𝓊(v) for k, v in d1.items()}
d1 ⊛ d2 == {k: (d1[k] ⊛ d2[k]) for k in d1.keys() & d2.keys()}
More information about the Python-ideas
mailing list