Type hinting a class decorator that returns a subclass #1529
Replies: 1 comment
-
What you're doing here is too dynamic for static typing — at least for today's static type system. There has been some discussion of adding intersection types to the type system, and that could be used to approximate the type of the value returned by this function, but even that would be only an approximation. In general, this function can't be made type safe because it's overriding attributes |
Beta Was this translation helpful? Give feedback.
-
Anyone knows who to annotate "cls" and return type for below function "examle_a"?
cls can be any class.
Beta Was this translation helpful? Give feedback.
All reactions