Memoryview Attributes

memoryview.obj

Expose the underlying object associated with the view. For ordinary bytes and bytearray exporters, this is the original object even for derived slices or casts. It is not a copy of the selected region. C-created views without an exporting Python object may expose None. The read-only attribute does not make the object itself read-only; mutations to a writable exporter may be visible through a view.

Formal Syntax & Structure

python syntaxpython
view.obj

Return Value

object | None

Underlying object, when present.

Working Example

Example Snippetpython
data = bytearray(b"ABC")view = memoryview(data)[1:]print(view.obj is data)data[1] = 90print(view.tobytes())
Python Reference