Best practice for mutually referencing classes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Best practice for mutually referencing classes

Des.P
What is the best way to accomplish this with traits?

class A(HasTraits):
        b = Instance(B)

class B(HasTraits):
        a = Instance(A)

Thanks!

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Best practice for mutually referencing classes

Jonathan March

class A(HasTraits):

    b = Instance('B')


class B(HasTraits):

    a = Instance('A')


On Fri, Sep 28, 2012 at 6:36 PM, Des.P <[hidden email]> wrote:
class A(HasTraits):
        b = Instance(B)

class B(HasTraits):
        a = Instance(A)


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev