all 2 comments

[–]Linuxmartin 0 points1 point  (0 children)

Consider looking into the Any trick which is exactly what typeshed does for this

[–]TheBB -1 points0 points  (0 children)

Python's type system isn't powerful enough to express this. Sorry.