Re:Dictionary union (PEP 584) is merged
by seemslegit on Tuesday February 25, 2020 @05:53PM
(#22418405)
imo
is more readable than a | b without knowing that a or b are defaultdicts and having to reason about which default callback will be used
[ Parent
| on HN ]
It’s also really expensive. This new operator works with any Mapping type without needing silly hacks.
Re:Dictionary union (PEP 584) is merged
by anonymoushn on Tuesday February 25, 2020 @10:19PM
(#22419983)
Note that a | b is already a disaster if you try to use subclasses of set. In python 2.7, iirc it would return a set of a's type but without calling the constructor. In python 3 it seems to return a set (not the type of a or the type of b).
Re:Dictionary union (PEP 584) is merged
by CameronNemo on Tuesday February 25, 2020 @11:29PM
(#22420280)
Not sure about the set operator, but this operator is meant to handle subclasses better than the status quo.