New submission from Jáchym Barvínek: The class collections.Counter should semantically contain only numbers, so it makes sense to define dot product od Counters, something like this:
def __matmul__(self, other): return sum(self[x] * other[x] for x in self.keys() | other.keys()) I find this useful ocassionaly. ---------- components: Library (Lib) messages: 292522 nosy: Jáchym Barvínek priority: normal severity: normal status: open title: Add __matmul__ to collections.Counter type: enhancement versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30196> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com