I was designing the following:
from functools import reduce
from operator import or_
dicts = [
{"a": 1, "b": 2},
{"c": 99, "d": 3},
{"e": 4}
]
merged = reduce(or_, dicts, {})
print(merged)
And from reading:
|
| Bitwise Or | ``a | b`` | ``or_(a, b)`` | |
And:
|
.. function:: or_(a, b) |
|
__or__(a, b) |
|
|
|
Return the bitwise or of *a* and *b*. |
I wasn't sure if or_ applies also to dictionaries, but according to the trivial implementation, of course it does :). Anyway, I thought it would be nice to rephrase the above 2 parts of the document somehow - not sure exactly how to do phrase it myself.
Linked PRs
I was designing the following:
And from reading:
cpython/Doc/library/operator.rst
Line 414 in ed73c90
And:
cpython/Doc/library/operator.rst
Lines 174 to 177 in ed73c90
I wasn't sure if
or_applies also to dictionaries, but according to the trivial implementation, of course it does :). Anyway, I thought it would be nice to rephrase the above 2 parts of the document somehow - not sure exactly how to do phrase it myself.Linked PRs