|
|
|
|
|
by thomk
2248 days ago
|
|
I appreciate the thoughtful response and I respectfully disagree. I agree with your point about non-technical users, I addressed that in the top level comment on this thread. Limiting what is accepted isn't hard at all, here's how you do it: In your config.py module, have a Config class that subclasses a superclass named, say, ConfigBase. ConfigBase implements __init_subclass__ and in there, you can dictate how a subclass is configured and raise descriptive errors if your rules are not followed. You can do the same thing with a metaclass. With this approach the class does not have to be mainline executable. You can pluck out what you need and use those plucked items however you see fit. You are essentially consuming a python script as a config file and not actually running it. |
|