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
Types with subclasses such as list[...] or dict[...] are not considered to be instance of type by isinstance() whereas standard types (list, dict, ...) are. This difference is surprising if we consider, for instance, that list is in the __mro__ of list[int]. I suspect that this inconsistency is a bug.
CPython versions tested on:
3.9, 3.10, 3.11, 3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered:
This was a deliberate change made due to a large number of issues that the previous behaviour caused. See #89828. I don't think we'll be changing this behaviour again.
Bug report
Bug description:
Types with subclasses such as
list[...]
ordict[...]
are not considered to be instance oftype
byisinstance()
whereas standard types (list
,dict
, ...) are. This difference is surprising if we consider, for instance, thatlist
is in the__mro__
oflist[int]
. I suspect that this inconsistency is a bug.CPython versions tested on:
3.9, 3.10, 3.11, 3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: