Skip to content

Suggestion on attributes containing dashes #142

Open
@aellwein

Description

@aellwein

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions