Skip to content

Confusing behavior when setting a ConfigTree to a dictionary #380

@zmbc

Description

@zmbc

Not sure if this is a bug per se, or a design issue, but I was very surprised by the output of this:

from vivarium import ConfigTree

config = ConfigTree()

config.update({'foo': {'bar': 'baz'}}, layer='base')

config.foo = {}

print(config)
print(config.foo)

The line config.foo = {} has no effect. I understand that this is consistent with .update, where dictionaries are used as the data model for nested keys and the update'd tree is merged into the current one, but setting an attribute feels like it should never be a no-op; it should either set something, or error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions