Message362827
> Im not sure if the dict(other) cast is the best way to go about it. Maybe this would work?
Yeah, I was imagining something like that... I used the cast for brevity in my reply but that probably wasn't helpful.
Note that for __or__, we probably want to check the type of the argument (for either dict or ChainMap, or maybe just Mapping), to keep it from working on an iterable of key-value pairs.
> I guess we need a __ror__ as well, in case there's some other mapping that doesn't implement __or__:
Agreed. Again, we can check for Mapping here to assure success for the copy() move.
> As a refinement, __or__ and __ror__ should perhaps check whether the operation can possibly succeed and return NotImplemented instead of raising? (Based on the type of other only, not its contents.)
Yup, see above. I think a check for Mapping should be fine. |
|
Date |
User |
Action |
Args |
2020-02-27 17:49:23 | brandtbucher | set | recipients:
+ brandtbucher, gvanrossum, rhettinger, mark.dickinson, scoder, serhiy.storchaka, steve.dower, josh.r, Aaron Hall, slam, xtreak |
2020-02-27 17:49:23 | brandtbucher | set | messageid: <1582825763.8.0.875939579822.issue36144@roundup.psfhosted.org> |
2020-02-27 17:49:23 | brandtbucher | link | issue36144 messages |
2020-02-27 17:49:23 | brandtbucher | create | |
|