Thorsten Kampe wrote:
> How can I test for type or instance of dictviews like dict_values?
Why do you want to?
> `isinstance({}.values, dict_values)` gives
> `NameError: name 'dict_values' is not defined`
You can "fix" this with
>>> dict_values = type({}.values())
or, depending on the use case, use another test:
>>> isinstance({}.values(), collections.abc.ValuesView)
True
> """
>>>> type({}.values())
> <class 'dict_values'>
> """
>
> Thorsten
--
https://mail.python.org/mailman/listinfo/python-list