reckoner | 2 Jul 16:15
Picon

Traits: Getting List(int) to report on removed or popped elements. Possible?

I am getting started with traits and I would like to use

class NodeList(HasTraits):
nodes = List(int)
<at> on_trait_change('nodes[]')
def _changed(self,name,new,old):
print 'Nodelist'

which works fine. however, when I do:

>> nl=NodeList(nodes=range(10))
>> nl.remove(3)

I would like to know which element in the list has been removed ( in this
example,'3'). how can I do this? On the other hand, when I do:

>> nl.append(3)

I CAN get Information that the element '3' has been added to the list
via the _changed() callback.

Then, how can I get nl.remove(3) and maybe even nl.pop() to report which
elements have been removed?

thanks in advance.

_______________________________________________
Enthought-Dev mailing list
Enthought-Dev@...
https://mail.enthought.com/mailman/listinfo/enthought-dev

Gmane