This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients Aaron Hall, brandtbucher, gvanrossum, josh.r, mark.dickinson, rhettinger, scoder, serhiy.storchaka, slam, steve.dower, xtreak
Date 2020-02-27.05:59:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think for `|=` the only choice is for it to be essentially an alias to `.update()`. So that means `cm |= other` becomes `cm.maps[0].update(other)`.

For `|` we are breaking new ground and we could indeed make `cm | other` do something like `ChainMap(other, *cm.maps)`.

I've not used ChainMap much (though I've seen some code that uses it) so I'm probably not the best judge of whether this is a good feature to have.

Note that `other | cm` will just do whatever `other.__or__` does, since ChainMap isn't a true subclass of dict, so it will not fall back to `cm.__ror__`. Basically ChainMap will not get control in this case.

Other thoughts:

- Maybe `cm1 | cm2` (both ChainMaps) ought to return `ChainMap(*cm2.maps, *cm1.maps)`?

- These semantics make `|=` behave rather differently from `|`. Is that okay? If not, which of them should change, and how?
Date User Action Args
2020-02-27 05:59:41gvanrossumsetrecipients: + gvanrossum, rhettinger, mark.dickinson, scoder, serhiy.storchaka, steve.dower, josh.r, Aaron Hall, slam, xtreak, brandtbucher
2020-02-27 05:59:41gvanrossumsetmessageid: <>
2020-02-27 05:59:41gvanrossumlinkissue36144 messages
2020-02-27 05:59:40gvanrossumcreate