[Python-ideas] Dict joining using + and +=
Pål Grønås Drange
paal.drange at gmail.com
Tue Mar 5 06:10:57 EST 2019
I just wanted to mention this since it hasn't been brought up, but neither
of these work
a.keys() + b.keys()
a.values() + b.values()
a.items() + b.items()
However, the following do work:
a.keys() | b.keys()
a.items() | b.items()
Perhaps they work by coincidence (being set types), but I think it's worth
bringing up, since a naive/natural Python implementation of dict
addition/union would possibly involve the |-operator.
Pål
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190305/03670b90/attachment.html>
More information about the Python-ideas
mailing list