Exception problems
Richard Jones
rjones at ekit-inc.com
Wed Dec 4 19:48:12 EST 2002
On Thu, 5 Dec 2002 11:32 am, Fernando Pérez wrote:
> Richard Jones wrote:
> > I've just noticed that exceptions aren't caught in the following
> > situation:
> >
> > . script/module a.py defines an exception FooExc
> > . a.py imports module b.py
> > . b.py has function f() which imports FooExc from a.py
>
> You have a circular import. This is almost guaranteed to be a sign of
> misdesign, and will probably lead to lots of headaches elsewhere. I'd
> suggest you rethink the code structure to break the import loop. Something
> like moving into c.py whatever both a.py and b.py need instead of having
> two snakes biting each other's tail :)
Granted the circular import is a sign of poor design, but it's exposing
something that seemed quite strange to me.
Richard
More information about the Python-list
mailing list