UniCoreFW

is_data_view()

Check if obj is a DataView (memoryview in Python).

Implementation

Args: obj: The object to check Returns: True if obj is a memoryview, False otherwise

Example

from array import array is_data_view(memoryview(array('i', [1, 2, 3])))

Expected output: True

Source Code

def is_data_view(obj: Any) -> bool: return isinstance(obj, memoryview)