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

Implement __getitem__ and __setitem__ methods #42

Open
ziggycross opened this issue Apr 7, 2024 · 0 comments
Open

Implement __getitem__ and __setitem__ methods #42

ziggycross opened this issue Apr 7, 2024 · 0 comments

Comments

@ziggycross
Copy link

It seems the current approach for managing config is with .get and .set methods.
I believe it would make sense to also implement __getitem__ and __setitem__ dunder methods in addition to this.

For example, the code example

config.set('number', 42)
config.get('number')

could also be written as

config["number"] = 42
config["number"]

Looking at the source, this should be a relatively small update to implement. If you think this would be acceptable, I am happy to add it myself and submit a PR.

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

No branches or pull requests

1 participant