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

Immutable/frozen dotmap #48

Open
worldmind opened this issue Apr 4, 2019 · 1 comment
Open

Immutable/frozen dotmap #48

worldmind opened this issue Apr 4, 2019 · 1 comment

Comments

@worldmind
Copy link

Hi, I am searching a best type for config data, usually it is nested dict, but on my opinion config must:

  1. have dot notation for readability,
  2. be immutable for safe using (config is global variable).
    Can DotMap be immutable?

P.S. I found https://github.com/cdgriffith/Box/ but not sure that it popular = good tested.

@sesquideus
Copy link

I usually use

configFile = yaml.safe_load(fileObject)
config = dotmap.DotMap(configFile, _dynamic = False)

which works fine. However It would be nice to be able to switch between dynamic and "static" DotMaps. For instance I want to load the config file, apply command line overrides (using argparse) and then lock the config. Currently I iterate over the DotMap and recursively set _dynamic to False.

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

2 participants