I want to check an iterable of unknown length (let's say a list ) contains only a given type (let's say float) using match case (there are other cases, only this one gives me problems).
case [*elems] if all([isinstance(elem, float) for elem in elems]): return num
This one seems to work, but is really un-pythony. It seems there should be a simpler way. Can you help me?
I tried [float()], list[float()], list[float], and [float(), *elems]. None of them do the trick.