[Python-ideas] Dict joining using + and +=

Steven D'Aprano steve at pearwood.info
Fri Mar 1 08:18:09 EST 2019


On Fri, Mar 01, 2019 at 09:58:08PM +0900, INADA Naoki wrote:

> >>> {1} <= ({1} | {1.0})
> True
> >>> {1.0} <= ({1} | {1.0})
> True
> 
> So dict + dict is totally different than set | set.
> dict + dict has los at equality level.


Is that an invariant you expect to apply to other uses of the + 
operator?

py> x = -1
py> x <= (x + x)
False

py> [999] <= ([1, 2, 3] + [999])
False



-- 
Steven


More information about the Python-ideas mailing list