Iterables can be infinite/don't necessary have a length, so this line of code invalidates the annotation. Length requires Sized. Could also use Collection[M] or Sequence[M] though those are a tad less generic.
collections.abc.Collection
ABC for sized iterable container classes.
Or, maybe the length can be circumvented.
Either way, was surprised to get a runtime error here - is this project type-checked in CI?
Iterables can be infinite/don't necessary have a length, so this line of code invalidates the annotation. Length requires
Sized. Could also useCollection[M]orSequence[M]though those are a tad less generic.collections.abc.CollectionOr, maybe the length can be circumvented.
Either way, was surprised to get a runtime error here - is this project type-checked in CI?