I have a program which needs some constant data, in JSON-like format. However, this data only needs to be consumed by my Python program, and by making it Python code, I can include types like datetime.datetime
and enums, as well as custom types and any other type I wish to use. It would also improve performance, as parsing JSON is skipped in this. Would it be a bad idea to provide my data as Python source code, using Python data types and import it when I need to use it? Are there downsides to this approach?
I am talking about storing the data in variables initiated when the program is run. In particular, I want to use enums; of course these can be replaced by strings, but I feel that the likelyhood for bugs and other mistakes is higher when using strings. I'd also like to be able to use objects with methods on them. This is data that is meant to be written by humans and read by programs.