New submission from Kaleb Barrett <dev.ktbarr...@gmail.com>:

I have type aliases of Unions like so:

Request = Union[WriteRequest, ReadRequest]

I'd like to be able to use "Request" in an isinstance check rather than having 
to duplicate the information in a tuple to pass to the check. Currently I get:

TypeError: Subscripted generics cannot be used with class and instance checks

Seems like Unions could be used here interchangeably with tuples since they 
mean the same thing in this context. Of course this would only work if the 
element types are being capable of being used in isinstance checks.

----------
messages: 396658
nosy: ktbarrett
priority: normal
severity: normal
status: open
title: Using typing.Union in isinstance checks
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44529>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to