Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_entries method #7

Open
stolarczyk opened this issue Feb 15, 2019 · 1 comment
Open

remove_entries method #7

stolarczyk opened this issue Feb 15, 2019 · 1 comment

Comments

@stolarczyk
Copy link
Member

I think it would be nice to have a remove_entries by key method since there is the add_entries.
Not sure what would be the best way to specify the level of the entry ot remove. Relevant in case there are multiple keys with the same name on different levels.

@vreuter
Copy link
Member

vreuter commented Feb 16, 2019

I agree -- I think there should be symmetry. I prefer to remove add_entries from the API, though, first by deprecation then by actual removal. The only things it's doing differently than an ordinary update call are type checking the entries argument, handling the dispatch to __setitem__ to ensure that Mapping values become properly typed, and then returning then instance itself.
This could all be accomplished instead with an overridden update, which--besides solving the odd asymmetry--would be more familiar to users since update is an ordinary dict operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants