
Feb. 5, 2020
10:19 a.m.
05.02.20 14:27, Musbur пише:
I have one suggestion: Wouldn't it be useful for these operators to also accept sets (functionally acting like a dict with None for all values)? This would make it very elegant to 'normalize' dicts by pruning (dict & set) or padding (set | dict) dictionaries. I would find this useful for efficient data sanitation purposes, as when processing input from web forms.
d = {} d |= {(1, 2)} What is d now? {1: 2} or {(1, 2): None}