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

Make construction of AttributeDict recursive #3005

Merged

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Jun 14, 2019

Fixes #2996

This means that dictionaries nested in the dictionaries will also
recursively be turned into AttributeDicts. This has the benefit that
when constructing a nested dictionary like:

dictionary = AttributeDict({'sub': {'name': 1}})

the nested keys can all be accessed as attributes, i.e.:

dictionary.sub.name

whereas before one had to do:

dictionary.sub['name']

which is not very intuitive.

@coveralls
Copy link

coveralls commented Jun 14, 2019

Coverage Status

Coverage increased (+3.06%) to 72.957% when pulling f6bed23 on sphuber:fix_2996_make_attribute_dict_recursive into 6c544bf on aiidateam:develop.

@sphuber sphuber force-pushed the fix_2996_make_attribute_dict_recursive branch from 8a7fa86 to 232531d Compare June 14, 2019 12:54
This means that dictionaries nested in the dictionaries will also
recursively be turned into `AttributeDicts`. This has the benefit that
when constructing a nested dictionary like:

    dictionary = AttributeDict({'sub': {'name': 1}})

the nested keys can all be accessed as attributes, i.e.:

    dictionary.sub.name

whereas before one had to do:

    dictionary.sub['name']

which is not very intuitive.
@sphuber sphuber force-pushed the fix_2996_make_attribute_dict_recursive branch from 232531d to f6bed23 Compare June 14, 2019 13:39
@sphuber sphuber merged commit 607f973 into aiidateam:develop Jun 14, 2019
@sphuber sphuber deleted the fix_2996_make_attribute_dict_recursive branch June 14, 2019 14:07
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

Successfully merging this pull request may close these issues.

AttributeDict behavior
3 participants