problems with circular references

jimh jim at jim.jim
Wed Mar 27 15:51:51 EST 2002


I am working on python code that consist of quite a few files (about 50;
each file contains one class).  All errors returned by functions are numeric
and are defined in the individual files.  There is a MessageCatalog.py class
which will map these numbers into strings.  This MessageCatalog.py has to
import all of the 50 other files to have access to their error numbers.  So
far, so good - no problems yet.

Here is the problem: Most of these 50 classes need to use the MessageCatalog
themselves.  This means, of course, that classA imports MessageCatalog which
imports classA.  This doesn't work very well.

Does anyone have ideas on how to deal with this situation?

Thanks,
Jim





More information about the Python-list mailing list