enthought / enthought/traits

Provide better support for index handling for consumers of ListChangeEvent

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

Description

Consumers of `ListChangeEvent` need to handle both the case of an `int` event index and a `slice` event index, typically leading to code that's branchy, awkward, and hard to test thoroughly, as well as requiring understanding of how the event index is normalised. Traits could help here by providing some covenience methods or properties on the `ListChangeEvent` object to allow easy retrieval of list indices.

An example use-case is needing both the indices and the values of removed or added entries, in a way that works regardless of whether `event.index` is an integer or a slice.

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.