Configuring an object via a dictionary

Tobiah toby at tobiah.org
Fri Mar 15 15:22:30 EDT 2024


I should mention that I wanted to answer your question,
but I wouldn't actually do this.  I'd rather opt for
your self.config = config solution.  The config options
should have their own namespace.

I don't mind at all referencing foo.config['option'],
or you could make foo.config an object by itself so
you can do foo.config.option.  You'd fill it's attributes
in the same way I suggested for your main object.






More information about the Python-list mailing list