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

Suggestion on attributes containing dashes #142

Open
aellwein opened this issue Jul 14, 2021 · 0 comments
Open

Suggestion on attributes containing dashes #142

aellwein opened this issue Jul 14, 2021 · 0 comments

Comments

@aellwein
Copy link

Consider this example:

>>> a = addict.Dict({'test-id': 123})
>>> a.test-id
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for -: 'Dict' and 'builtin_function_or_method'

Improvement suggestion: as for me, it would be nice if addict would support a.test_id (i.e. replace dashes with underscores in attribute names, like for example, argparse does for options).

Or even better: give user a possibility to define a replacement set or provide a callback function for it.

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