diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4261,6 +4261,15 @@ An example of dictionary view usage:: >>> keys ^ {'sausage', 'juice'} {'juice', 'sausage', 'bacon', 'spam'} +.. note:: + To check whether a variable is a view object, Python provides an + :term:`abstract base class` for each type of view object, to allow instance + and subclass checking with :func:`isinstance` and :func:`issubclass`. The + :class:`collections.abc.KeysView`, :class:`collections.abc.ValuesViews`, + and :class:`collections.abc.ItemsView` ABCs may be used to check for + :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict.items`, respectively. + To check for any type of view object, use + :class:`collections.abc.MappingView`. .. _typecontextmanager: