[Python-ideas] Implementing a set of operation (+, /, - *) on dict consistent with linearAlgebrae

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Oct 30 18:53:20 EDT 2018


> In [12]: a= mdict(a=[2], b='a')
> In [13]: a+a

Aren't you reinventing the Counter type?

>>> from collections import Counter
>>> c = Counter(a=1,b=2)
>>> c + c
Counter({'b': 4, 'a': 2})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181030/a6f1b293/attachment-0001.html>


More information about the Python-ideas mailing list