Parse file upon initialization and make accessible to all classes
<p>Essentially, when the pyramid app starts, I need to parse a file and make the data from that file available to the whole app. On top of that, I need to monitor the file for changes, it's essentially a config file. I was considering just making a singleton and initializing it when the app starts up when Configurator is initialized. Is that the best way to do it, or are there any other approaches I should follow/consider?</p>

<p>Sorry, new to pyramid and python, thank you!</p>

<p>As noted in many places, <a href="http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons">Singleton is considered a code smell</a> and as such, should be avoided. IMHO, a <code>Singleton</code> <em>can</em> be used if there's a reasonable trade-off. For example, if using a <code>Singleton</code> boosts the performance in a significant way. In your situation this just might be the case: If the config file is used in many places across you app, reading the file multiple times might impact your performance. However, if you choose to use a Singleton, keep in mind the dangers that come with it.</p>

<p>To answer you question, I don't think it's possible to tell what's the <em>best</em> way for you to go, because that depends on your specific app. I can only suggest that you take into account the pros and cons of each option, and making your choice depending on your needs.</p>

python python-2.7 oop pyramid