Traits listener bug with multiple identical items in a single list.
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Traits listeners attached to list items aren't handled correctly in situations where an item appears in a list more than once. Here's an example, showing a failure of a traits listener to trigger:
``` python
from traits.api import HasStrictTraits, Int, List, on_trait_change
class Apple(HasStrictTraits):
count = Int(0)
class Bowl(HasStrictTraits):
apples = List(Apple)
@on_trait_change('apples:count')
def print_status(self, obj, name, old, new):
print "Count updated from {} to {} for {}".format(old, new, obj)
granny_smith = Apple()
bowl = Bowl(apples=[granny_smith, granny_smith])
granny_smith.count = 42 # Triggers the listener, as expected.
bowl.apples.pop()
granny_smith.count = 1729 # Listener not triggered. (Surprise!)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.