You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that's currently impossible because of two reasons:
Type intersections aren't implemented yet (Introduce an Intersection #213),
which you would need to express Callable[[type[_T]], type[_T] & MyType].
Types can be final, in which case you cannot subclass them, e.g. types.NoneType is marked as final.
There does not appear to be a type for final types (typing.Final is something different),
which you would need to exclude the type with something like Not[Final] in the TypeVar bound. Note that Not[T] also isn't implemented yet (Introduce a Not type #801).
Hi
I would like to type a decorator which takes as input a class and returns the same class with added attributes, i.e., a subclass.
Example:
Been searching for an answer and experimenting for a few days now and can't find anything concrete. Any help would be much appreciated
Thank you
The text was updated successfully, but these errors were encountered: