I was going through this answer where I found that <class 'dict_items'>
is a subclass of <class 'collections.abc.ItemsView'>
. You can test this using:
>>> import collections
>>> issubclass({}.items().__class__, collections.abc.ItemsView)
True
However, I went a bit further and checked the __mro__
attribute of <class 'dict_items'>
and as this is a subclass of <class 'collections.abc.ItemsView'>
, it should be printed when I print the __mro__
attribute but it isn't there.
>>> {}.items().__class__.__mro__
(<class 'dict_items'>, <class 'object'>)
I also checked the subclasses of <class 'collections.abc.ItemsView'>
>>> collections.abc.ItemsView.__subclasses__()
[<class 'collections._OrderedDictItemsView'>]
Can anyone tell me why am I getting this?