This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jáchym Barvínek
Recipients Jáchym Barvínek
Date 2017-04-28.10:19:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493374760.56.0.320449301178.issue30196@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-04-28 10:19:20Jáchym Barvíneksetrecipients: + Jáchym Barvínek
2017-04-28 10:19:20Jáchym Barvíneksetmessageid: <1493374760.56.0.320449301178.issue30196@psf.upfronthosting.co.za>
2017-04-28 10:19:20Jáchym Barvíneklinkissue30196 messages
2017-04-28 10:19:20Jáchym Barvínekcreate