Remove None from Interval type parameter#178
Merged
Merged
Conversation
Contributor
Author
|
The idea is to start using |
Contributor
Author
`Interval`'s type parameter no longer includes `None`. The exported type variable `LessThanComparableOrNoneT` (bound to `LessThanComparable | None`) was deprecated and replaced with `LessThanComparableT` (bound to `LessThanComparable`). `None` is still accepted as a value for `start` / `end` to indicate an unbounded side, but it is treated purely as bound metadata rather than a value in the interval's comparable space. Note that explicitly using `Interval[int | None]` still works, as `(int | None) | None` is equivalent to `int | None`, even when it is no longer needed nor recommended. Old code will mostly work, but there is one soft breaking change: `None in some_interval` and `None in some_interval_set` is now a type-check error at call sites, matching the design intent that `None` is a bound marker and never a member value. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This was referenced Jul 3, 2026
Draft
Marenz
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interval's type parameter no longer includesNone. The exported type variableLessThanComparableOrNoneT(bound toLessThanComparable | None) was deprecated and replaced withLessThanComparableT(bound toLessThanComparable).Noneis still accepted as a value forstart/endto indicate an unbounded side, but it is treated purely as bound metadata rather than a value in the interval's comparable space.Note that explicitly using
Interval[int | None]still works, as(int | None) | Noneis equivalent toint | None, even when it is no longer needed nor recommended. Old code will mostly work, but there is one soft breaking change:None in some_intervalandNone in some_interval_setis now a type-check error at call sites, matching the design intent thatNoneis a bound marker and never a member value.