Repository navigation
📝 docs: document that ImmutableMap | merges any Mapping - #84
Merged
nstarman merged 1 commit intoOct 10, 2026
Merged
Conversation
Since GalacticDynamics#82, frozendict | other merges only a dict or frozendict, matching the Python 3.15 built-in. ImmutableMap.__or__ intentionally stays looser and merges any Mapping. Document that in the docstring and README, and pin it (and that the reflected | is not loosened) with a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 3
Lines ? 98
Branches ? 0
========================================
Hits ? 98
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #82,
frozendict | othermerges only adictorfrozendict, matching the Python 3.15 built-in.ImmutableMap.__or__deliberately stays looser and merges anyMapping. This PR documents that difference and adds tests so it doesn't change by accident. There is no behaviour change.Changes
ImmutableMap.__or__docstring: explains thatImmutableMap | otheraccepts anyMapping, whilefrozendict | otherdoesn't, and that the reflectedother | ImmutableMapcomes fromfrozendictand is not loosened.frozendict" section): one paragraph on this difference, telling users switching to the built-in to wrap such mappings indict(...).test_ornow checks that:ImmutableMap | Plain(...)merges (Plainis aMappingwith no|);frozendict | Plain(...)raisesTypeError;Plain(...) | ImmutableMapraisesTypeError.Verification
pytest: 135 passed on 3.10 and 3.13 (backport) and on 3.15.0 with jax 0.11.2 (built-infrozendict).prek run --all-filespasses.🤖 Generated with Claude Code