`AdaptsTo` trait fires change events even if value not changed
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
This happens only when the value does not "implement" the interface but only "supports" it.
For example, the script
```
from traits.api import *
class ICow(Interface):
pass
@provides(ICow)
class Cow(HasTraits):
pass
class Bull(HasTraits):
pass
register_factory(factory=lambda adaptee: Cow(), from_protocol=Bull, to_protocol=ICow)
class Moo(HasTraits):
cow = AdaptsTo(ICow)
def _cow_changed(self):
print 'CHANGED', self.cow
cow = Cow()
bull = Bull()
moo = Moo()
moo.cow = cow
moo.cow = cow
moo.cow = bull
moo.cow = bull
```
outputs
```
CHANGED <__main__.Cow object at 0x107259b30>
CHANGED <__main__.Bull object at 0x107259b90>
CHANGED <__main__.Bull object at 0x107259b90>
```
while we expect only one Bull event.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.