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

Restore correct classes to lists and tuples #9

Open
Rizhiy opened this issue Mar 14, 2018 · 2 comments
Open

Restore correct classes to lists and tuples #9

Rizhiy opened this issue Mar 14, 2018 · 2 comments

Comments

@Rizhiy
Copy link

Rizhiy commented Mar 14, 2018

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
Copy link

whq-hqw commented Jan 11, 2019

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
Copy link
Collaborator

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

if isinstance(value, (list, tuple)):
value = [self.__class__(x)
if isinstance(x, dict) else x for x in value]

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

3 participants