I'm creating a subclass of ConfigParser that is easier for me to use throughout my project:
class MyConfiguration(ConfigParser.ConfigParser):
def __init__(self, filename):
ConfigParser.ConfigParser.__init__(self)
self.readfp(open(filename))
def get(self, section, option):
return eval(ConfigParser.ConfigParser.get(self, section, option))
Question: are there any downsides (security, unintended consequences) to overriding the get() method with one that includes eval?
I'd rather bake the eval into the MyConfiguration class because I want to use Python data types (tuples, etc.) in my config files but I don't want to deal with evals all over my project code.