
Depends on what d is.
type({}) <class 'dict'>
So the result is {(1, 2): None}, but the ambiguity comes from the definition of {}, not from my proposal. Am 05.02.2020 18:19 schrieb Serhiy Storchaka:
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} _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ZUXJBYUH... Code of Conduct: http://python.org/psf/codeofconduct/