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
The type guard doesn't seem to work like an instance check:
fromtypingimportTypeGuard, AnyclassX: passclassY: passx: X=X()
assertisinstance(x, Y)
deff(z: Any) ->TypeGuard[Y]:
returnisinstance(z, Y)
reveal_type(x) # Revealed type is "a.<subclass of "X" and "Y">", which is great!x2: Xassertf(x2)
reveal_type(x2) # Revealed type is "a.Y", which is unfortunate.
This is causing problems with the definition of dataclasses.is_dataclasspython/typeshed#9723.