enthought / enthought/traitsui
Create decorator alternatives for magic names
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
Just like Traits, there are a few places where TraitsUI makes use of specially-named methods. At least two of these are:
- https://docs.enthought.com/traitsui/traitsui_user_manual/handler.html#extended_traitname_changed
- `[extended_traitname]_setattr` (See #1564)
A better, more modern strategy would be to provide a method decorator which marks methods as handlers for these use cases. For example, something like:
```
@handler_setattr('model.foo')
def set_model_foo(self, info, object, name, value):
...
```
This would need to be coupled with a registry of these methods on the handler.
Eventually, after some time, the magic names could be retired.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.