makinacorpus / easydict

Access dict values as attributes (works recursively)
GNU Lesser General Public License v3.0
294 stars 47 forks source link

Restore correct classes to lists and tuples #9

Open Rizhiy opened 6 years ago

Rizhiy commented 6 years ago

Currently, all tuples, lists and their subclasses are converted to lists, which is not ideal. They should be converted back to their class/subclass (e.g. namedtuple).

BTW: why do you recurse down tuples/lists at all?

whq-hqw commented 5 years ago

Agreed, in some cases/libraries, input parameters type is fixed, which requires people to convert the easydict item back to whatever the function needs, seems to be a little bit awkward.

leplatrem commented 5 years ago

Don't hesitate to open a PR and fix it:

https://github.com/makinacorpus/easydict/blob/52eb7b31357a815f9b96a46a176e992aa1c5dfed/easydict/__init__.py#L125-L127