enthought / enthought/traits

TraitList use-case: enforcing uniqueness

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

Description

The current `TraitList` has per-item validation, but no global list validation. In particular, the min-length and max-length validation that was previously available on `List` traits seemed to add more complication that it was worth.

A use-case that turned up in an actual Traits-using project was enforcing uniqueness of the list contents (that is, ensuring that the list contained no duplicates).

It would be interesting to explore what changes we'd need to make to make that validation easily available to users, either via subclassing `TraitList`, or via adding a suitable hook within `TraitList` itself.

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.