I have an application that can be started using some user preferences. To do this, I use the ConfigParser from the underlying package to the
ConfigParser class. I have received a subclass of
ConfigParser , to specify each time without having to specify / set some preferences for
__getitem __ and
__setitem __ applies the applicable sections, sub-sections and options.
Some of those priorities (working directory, logging level ...) are quite wise for my code, I would like to check them each time to modify one of their items. To do this, I currently think of two approaches:
-
Writing a method that examines each item of my preferences, each of them is modified is. Every time an item is changed, it is very simple but not very efficient.
-
Write a check_item method (check_logger, check_command_directory, check_blabla ...) for every preference and every time an item related checker is set, then it will be sent to
Getattr (self, 'check_% s'% items) (item)
I think the second approach would be better than before.
Will you see some of those design options?
Thank you very much
- Make them pure python Can apply in;
- Use a (trade) rule language like BPL to support Python for this project;
- Use a hindrance-based system to check that the set of values does not violate any rule directly or indirectly. You can see, for example, this is a type of "solver" - but it will inform you that there is no solution to the set of "priorities".
The first choice for ordinary simple minor obstacles is my favor, though, as I explained it in comments, I do not think "check one item at a time" valid The approach to being - except for the simplest cases it is because some item values can not be valid or valid based on the value of one or more other items < / P>
No comments:
Post a Comment