These are chat archives for ipython/ipython

28th
Mar 2018
Arun Kaliraja Baskaran
@akr8986
Mar 28 2018 13:25

Hi, I am trying to use the traitlets functionality for my project. Suppose if a trait is of instance of a particular class how do i observe change in value for a member of the class..

example:

class A:
def init(self,val):
self.value = val

class myApp(HasTraits):
myA = Instance(A,kw={'val':2})

I want to have an observe method to be called if 'value' member variable of object myA is changed.. SOmething like below:

@observe('myA.value')
def onValueChange(self,change):
return

is it possible with the trailets implementation?