Open FooSoft opened 5 years ago
I dunno.
I've done that kind of thing at work a lot to make programs more easily configurable for users. Sometimes even going so far as to read YAML files into memory, use a tool to parse them into JSON strings on the first pass, and parse the JSON strings into usable data structures on the second pass.
For a program which I'm just going to use myself it seems kind of silly to slow it down by maintaining the data separately when I can just define the data structures directly.
IMHO it's good to separate data and logic, and maybe it's even more efficient since parsing JSON is going to be faster than parsing python. You will have to build up the data structures, sure, but you will have to do that in either case.
I just played around a bit with a JSON solution. It's slow and ugly for two reasons:
I believe I can solve problems with the first point by not being lazy and implementing JSON configuration the "right" way. I believe the second point would be solvable with additions to the interpreter, which is way out of scope for this little project. ;)
Meh, creating actual classes just to store data in Python is overrated :grin:
Awesome that you are using python now :)