Skip to content

Conversation

@mscuthbert
Copy link
Member

cannot use the new class definition directly because of the magic not working with anything that includes self.class(*...) -- but we can subclass a typed base class.

a,b,c,d,e,f = ZeroSortTupleHigh
reveal_type((a, b, c, d, e, f))
tuple[builtins.int, builtins.float | fractions.Fraction, builtins.int, builtins.int, builtins.int, builtins.int]
reveal_type(ZeroSortTupleHigh)
tuple[builtins.int, builtins.float | fractions.Fraction, builtins.int, builtins.int, builtins.int, builtins.int,
           fallback=music21.sorting.SortTuple]

before:

reveal_type(ZeroSortTupleHigh)
tuple[Any, Any, Any, Any, Any, Any, fallback=music21.sorting.SortTuple]

update Version because removal of .flat invalidated caches

cannot use the new class definition directly because of the magic not working with anything that includes self.__class__(*...) -- but we can subclass a typed base class.

a,b,c,d,e,f = ZeroSortTupleHigh
reveal_type((a, b, c, d, e, f))
tuple[builtins.int, builtins.float | fractions.Fraction, builtins.int, builtins.int, builtins.int, builtins.int]

reveal_type(ZeroSortTupleHigh)
tuple[builtins.int, builtins.float | fractions.Fraction, builtins.int, builtins.int, builtins.int, builtins.int, fallback=music21.sorting.SortTuple]

update Version because removal of .flat invalidated caches
@coveralls
Copy link

Coverage Status

coverage: 93.068%. remained the same
when pulling a5579d2 on typed_sort_tuple
into 3a04fb6 on master.

@mscuthbert mscuthbert merged commit 488c358 into master Oct 8, 2025
7 checks passed
@mscuthbert mscuthbert deleted the typed_sort_tuple branch December 6, 2025 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants