News for hackers. Stuff that matters.
Re:Python 3.15: features that didn't make the headlines by JohnKemeny on Thursday May 21, 2026 @08:28AM (#48221556)
> I've left this one to the bonus section because I've never used set operations on Counters and I'm finding it extremely hard to think of a use case for xor specifically. But I do appreciate the devs adding it for completeness.

Check out symmetric difference

https://en.wikipedia.org/wiki/Symmetric_difference

Re:Python 3.15: features that didn't make the headlines by qsort on Thursday May 21, 2026 @09:17AM (#48222143)
Yeah, but applied to counters it would be the symmetric difference between multisets, which doesn't have a natural definition. If I understood the proposal they'd be defining it as absolute value of the difference of the counts, which isn't even associative.

If they only considered parities it could be interpreted as addition in F_2, which is more natural, but I'd still agree that it's hard to see how you'd use something like this in practice.

Re:Python 3.15: features that didn't make the headlines by gtheodor on Thursday May 21, 2026 @05:03PM (#48228862)
You can get the L_k distances between the two counters. E.g. if you sum the absolute value of the difference of the counts, you get the L_1 distance between the counters. If you raise them to the n^th power and then sum them, you get the L_n distance. For n=2, that's the Euclidean distance (squared).