Skip to content

Rethink max_exclusive, convert to max_inclusive? #23

@samuelcolvin

Description

@samuelcolvin

If we have MaxLen, and (in pydantic at least) that can be set via a max_length argument.

I really think this should mean "maximum inclusive", not "maximum exclusive" as currently documented.

This matches (IMHO) much better people's assumption about what MaxLen(5) or max_length=5 or Len(0, 5) means:

"The airbnb allows maximum 5 guests", you would assume 5 guests were allowed, not just 4

If for the sake of correctness, that involves either:

  • treating slices differently
  • or, removing the recommendation on allowing slices

That's sad, but I think a price worth paying.

At the end of the day max_length=5 meaning any length up to 4, won't fly in pydantic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions