Objects and behaviour
What is an object?
On this page
An object is a program value that can participate in operations and, in languages such as Python, has an identity. Some objects carry mutable state. Others, including Python strings, keep the same value throughout their lifetime. An empty list is already an object before anyone appends an element.
Worked example
Pythonbuffer = bytearray(b"AB")
alias = buffer
alias[0] = ord("Z")
assert buffer == b"ZB"
assert type(buffer) is bytearrayExplore class relationships in the OOP Playground