class static vs. module global

Aahz Maruch aahz at netcom.com
Thu Jun 24 12:31:41 EDT 1999


I have a module aC, which conveniently holds a class aC.  During some
recent changes, I needed to share information across class instances.
Primarily to localize things, I elected to store the information in the
class.  Anyone want to share opinions on why I should instead have used
a module global variable?  Or perhaps a different approach?

(Some additional information: instances of aC get invoked by aQ; with
the exception of two methods, aQ knows nothing about the actual workings
of aC, so storing the info in aQ would be a bad idea.  If it helps any,
the information I'm storing in aC is essentially a cache that gets
flushed regularly.  Also, I was trying to preserve the structure of
existing code as much as possible to make testing and re-integration
easier.)
-- 
                      --- Aahz (@netcom.com)

Hugs and backrubs -- I break Rule 6       <*>      http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het

Javascript: The 90s incarnation of the Commodore 64 Sprite -- SJM




More information about the Python-list mailing list