3 ms·
> It's always been on my Python wish list that dicts would subclass sets, as dicts are essentially sets with values attached. > There's no reason you shouldn't
by dtech 8y ago
> It's always been on my Python wish list that dicts would subclass sets, as dicts are essentially sets with values attached.
> There's no reason you shouldn't have always been able to say d | d2, same as sets.
I don't agree with this view, mainly because merging a dict is not associative, while unionizing a set is.
The actual operation for "a + b" is "add everything from b set to a", and + more closely resembles that than |.