2

I'm using the ConfigParser to read the configuration information stored in a file. I'm able to read the content and use it across other modules in the project. I'm not sure if the configuration file is read every time I call config.get(parameters). How can I make sure that the configuration information is read only once and rest of the time its read from the cache.

1
  • 2
    Have you looked at the source code of ConfigParser to see what it does?
    – David Z
    Jun 24, 2009 at 18:39

2 Answers 2

2

I would try assigning the configuration to a variable.

configVariable = config.get(parameters)

Then you can pass the configuration variable to other modules as necessary.

1

The default implementation of the ConfigParser class reads its data only once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.