enthought / enthought/traits

Extended trait name for anytrait on a HasTraits attribute

Open
#533 1 comment 0 reactions 0 assignees View on GitHub
component: documentation
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

First, a code snippet:
```
class B(HasTraits):
s = Int
t = Int

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

@on_trait_change('b+')
def fun(self):
print("this should fire when a trait on `b` changes")
```

If my class `A` has a Traits attribute `b` which is itself a HasTraits object, how can I set up a trait change notification for when any attribute on the attribute object `b` changes? This might be [documented here](https://docs.enthought.com/traits/traits_user_manual/notification.html#semantics) but I'm not sure. This issue is to suggest that the documentation be made more clear and to maybe add this usage as an example.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.