enthought / enthought/traits

Refactor and group change handler data into an object

Open
#1,063 0 comments 0 reactions 0 assignees View on GitHub
type: refactor
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

In the notifiers for observers, we have these pieces of information:
https://github.com/enthought/traits/blob/4145b41912fc6df99b99f33da2f7cac436336b72/traits/observers/_trait_event_notifier.py#L44-L57
https://github.com/enthought/traits/blob/4145b41912fc6df99b99f33da2f7cac436336b72/traits/observers/_trait_event_notifier.py#L69-L72

The `handler`, `target` and `dispatcher` are defined by the user at the time when `observe` is called (`observe` being the future replacement of `on_trait_change`). In other words, they don't change throughout the lifetime of the "observe" action and only the user has a say in what they should be.

They can therefore be grouped together, making it easy for them to be passed around and compared.

This refactoring will not affect the user facing API.

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.