traits icon indicating copy to clipboard operation
traits copied to clipboard

Provide better support for index handling for consumers of ListChangeEvent

Open mdickinson opened this issue 2 years ago • 0 comments

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.

mdickinson avatar Jan 31 '22 09:01 mdickinson