great! Thanks it makes perfect sense, but before attempting some code rewrite I just wanted to be sure ;-)
Regards, - Jorgen On 5/13/07, Christoph Haas <[EMAIL PROTECTED]> wrote: > On Sun, May 13, 2007 at 11:41:12AM +0200, Jorgen Bodde wrote: > > I am wrestling with some architecture inside my app. Let's say I have > > a tunings collection, which contains e.g. 23 types of guitar tunings. > > In my song object I want to restore a relation between one of the > > tuning objects inside the tunings module. > > > > I already figured out I need somethign like a global collection inside > > the tunings module,. but how global is it? When I am inside my app > > object, and import the tunings module, can I access the same global > > class as when I am inside my songs module and load the tunings module? > > You are on the right way. If you import the same module a second time in > another place of your application you get access to the exact same data. > That is called a "singleton". I often use such a singleton for global > configuration data. > > > So basically I want to access the same global list in both modules, > > but not re-create the list in every module since it should be restored > > by the database layer once. > > Import your global module and just run the initalisation once. That > should do it. > > > Thanks for any advice, I do not want to make a global manager object > > that I need to pass around all the time, that would be silly.. > > Indeed. That would suck. > > Christoph > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list