Conversation
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.
Dict((['a', 1], ['b', 2]))raisesTypeErrorinstead of producing{'a': 1, 'b': 2}. A tuple containing just one list pair raisesIndexError. The constructor mistakes the outer tuple for the single-pair shortcut because it only recognizes a tuple, rather than a list, as the first nested pair. The same pairs already work in a list or generator, and tuple-of-pairs construction was introduced in #37.Route tuples beginning with a list pair through the existing iterable-of-pairs path. This retains the single-pair tuple shortcut and the existing recursive conversion of nested dictionaries.
Add regression coverage for multiple list pairs, a single list pair with a nested dictionary, mixed list/tuple pairs with a tuple key, and the existing tuple-of-tuples form. Each case runs for both
Dictand its test subclass.Validation:
python -m unittest -q test_addict: all 136 tests passed on Windows with CPython 3.14.0 and Ubuntu 24.04 with CPython 3.11.16.python -m compileall -q addict test_addict.pyandgit diff --check: passed.The older Python versions in the CI matrix were not run locally.
Developed with assistance from OpenAI Codex.