osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why no '|' operator for dict?


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