Skip to content

Dynamically create ConfigurationSets? #93

Answered by tr11
middlec000 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this was one of the use cases the lib was build for. Try this:

cfg = config.ConfigurationSet(
  config.config_from_dict(config_default), 
  *[config.config_from_dict(config_choices[choice]) for choice in user_input]
)

The issue with your code above is that a ConfigurationSet expects the configs as arguments and you're passing a list -- unwrapping with the * will do the trick.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@middlec000
Comment options

Answer selected by tr11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants