Circular Inheritance

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Tue Jul 1 20:00:29 EDT 2003


On Tue, 01 Jul 2003 15:36:11 -0700, jinal jhaveri wrote:
> B requires C
> C requires A
> A requires B
> 
> and when I try to do this using 
> from ...import....
> it tells me that you cannot import this. 

Don't Do That Then.

Re-design the modules so that inheritance is a hierarchy.  A band-aid
solution may be to create a new class that mediates between two others,
breaking the circle.  Much better is to figure out why the classes need
to know so much about each other, and redesign them with smaller,
simpler interfaces.

Even if there were a way to do circular inheritance, it would be a
nightmare to understand, so needs to be redesigned anyway.

-- 
 \         "I'm beginning to think that life is just one long Yoko Ono |
  `\   album; no rhyme or reason, just a lot of incoherent shrieks and |
_o__)                                   then it's over."  -- Ian Wolff |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list