Skip to content

Add unique constraint to list? #296

Closed
@samuelcolvin

Description

@samuelcolvin

I'm not sure about this, it would need to have minimal or no impact on performance when switched off.

Some questions if we are to support it:

  • Should we implement unique only on the list validator or on tuple, set, frozenset and general iterables as we build the vec?
  • Should we implement a unique check on set and frozenset validators - this would have minimal performance impact as it would involve simply checking that the length of the input before and after creating the set, but sets loose order so won't be sufficient for some scenarios
  • what's the most performant way to implement this in rust??? I guess for list[int] and a few other types, we could do something pretty performant with an AHashSet but a general case will require some fairly slow python.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions