Re: Classes referencing each other

2006-09-04 Thread Manuel Bleichner
> Does the "EMCenter" really need to /subclass/ from all of those? Or > would it be better to make some of those attributes of an EMCenter > INSTANCE (passing in instances of the others to the __init__() ). > > class EMCenter(object): > def __init__(self, b, r, c, ol): >

Re: Classes referencing each other

2006-09-01 Thread Manuel Bleichner
Hi, thanks for your answer, too :) Your solution won't do it, because of reasons I explained in the answer to Georg Brandl. > BTW, care to tell us what the connections mean? Applications of > connected instances of the one class are of course very common, but 50 > classes connected in a cyclic fa

Re: Classes referencing each other

2006-09-01 Thread Manuel Bleichner
Thanks for the answer. > You could move all connections to a central location after the > class definitions, such as > > class A: pass > class B: pass > class C: pass > > connections = {A: (B, C), B: (C,), C: (A,)} I think I simplified my classes a bit too much :) Actually there are multiple typ

Re: Classes referencing each other

2006-09-01 Thread Manuel Bleichner
Thanks for your answer :) > You could use a function: > > class A(object): >@staticmethod >def connected_to(): return [B, C] > I already thought about such a solution, but since my code has to be compatible with python 2.3, i would have to use the connected_to = staticmethod(connected

Classes referencing each other

2006-09-01 Thread Manuel Bleichner
Hello list, I have searched for some time now, but no result... I'm having the following problem: In a module I have a huge number of classes of the form: class A(object): connected_to = [B, C] class B(object) connected_to = [C] class C(object) connected_to = [A] As you s