problems with circular references

jimh jim at jim.jim
Wed Mar 27 17:21:20 EST 2002


>
> It sounds as though somehow or other you want to put the
> actual error number data for each class into MessageCatalog
> and give the 50 classes some interface for registering
> their error numbers with MessageCatalog.  Then MessageCatalog
> is oblivious to what other classes there are, except that
> at run time they tell it about themselves.  You could add
> another object for holding the error number data
> and have one instance per class---if that provides a convenient
> structure for accessing the error number data...
>
> susan
>

I will have to think about that one.  When a class accesses the
MessageCatalog, it may be requesting message text from _other_ classes'
errors.  Also, these are often called from cgi scripts, so they are run as a
one-shot deal.  Also(!), the case of an error is (theoretically) uncommon
and the MessageCatalog is only instantiated if an error occurs.  That way,
if no error occurs, there is no overhead with importing the MessageCatalog.

One thought I had was to split out all the error numbers from the class
files (kind of like .h versus .c files).  Then MessageCatalog.py would only
import the ".h" files and I wouldn't have the circular import reference.
However, that would add another 50(!) files.

Jim






More information about the Python-list mailing list