Why no '|' operator for dict?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Feb 5 04:59:55 EST 2018
On Mon, 05 Feb 2018 01:14:53 -0700, Ian Kelly wrote:
> On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman <frank at chagford.com>
> wrote:
>> So I have 2 questions -
>>
>> 1. Is there any particular reason why '|' is not supported?
>
> '|' is the set union operation, roughly equivalent to the set.union
> method. Dicts don't have a union operation. If they did, and the same
> key were found in both sets, what would be the value of that key in the
> union?
Obviously it should be a quantum superposition of the two values, which
remains uncertain until such time as you actually print the value and
observe it.
--
Steve
More information about the Python-list
mailing list