addict
addict copied to clipboard
Suggestion on attributes containing dashes
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.