I'm not sure the documentation contains any concrete info on the type of view objects. I wasn't able to locate it (i.e. <class 'dict_values'> in the dict's source code. Is there a way to explicitly specify this 'view class'? And does it make sense in the first place? Example:
def func1(arg: dictview) -> None:
pass
You're looking for the typing.MappingView type hint or any of its related types like KeysView, ItemsView, ValuesView.
typing.MappingView is now deprecated in python 3.9 , You can use collections.abc.MappingView
collections.abc.MappingView
collections.abc.ItemsView
collections.abc.KeysView
collections.abc.ValuesView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With