[issue30196] Add __matmul__ to collections.Counter

2017-04-30 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> rejected stage: test needed -> resolved status: open -> closed ___ Python tracker ___ __

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: The '|' should be '&' to avoid useless summing of 0 products. I think this should be rejected. Python's number and collections classes provide basic operations from which users can build application-specific functions. Or in the case of floats, we provide a

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Ivan Levkivskyi
Changes by Ivan Levkivskyi : -- nosy: +levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Periodically, I've looked at possibly adding these kind of extensions. The argument in favor in that it is easy to do and is an obvious extension with plausible utility. The main arguments against is that it represents feature creep far removed from the

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- versions: -Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bu

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Jáchym Barvínek
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 u