On 02/26/2011 12:11 AM, Steven D'Aprano wrote: > [steve@sylar ~]$ python > Python 2.5 (r25:51908, Nov 6 2007, 16:54:01) > [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import lib > >>> import a > >>> lib.g > [] > >>> a.do_stuff() > >>> lib.g > [42] > > > Of course, when your application exists (or in this case, the > interactive session), the changes to lib.g will be lost because they > only exist in memory. If you want data to persist across application > runs, you need to arrange for the application to save the data to disk, > and then read it again when it starts up.
Aha, that explains why I didn't get any results. Each file got its own interpreter instance. > > Python has many tools for working with persistent data: Windows-style > ini files (module config parser), XML, JSON, Mac-style plists, YAML > (third-party module only), and pickles, to name only a few. In any case everything would be called in one interpreter, which I didn't know worked because I didn't test it like you showed it, but to be safe I definitely need to persist that data every once in a while. I'm slightly concerned about performance when it comes to reading/writing to disk a lot when doing things like that, since if this thing ever needs to scale I want it to be able to do that. Thank you, Steven -- Corey Richardson _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor