- Three attributes of an object: identity, type, and value
Identity: Uniquely identifies an object that can be obtained using the ID ()
Type: What type of value is saved, the actions that can be made, and the rules that follow. You can use the type () to get the inverse value for the type Object
Value: The data item represented by the object
Three attributes are assigned when an object is created, and the identity and type attributes are read-only. For new style types and classes, the type of the object can also be changed
Object variability: Refers to whether the value of an object can be changed
2, the bool value of the following object is False
0.00.0+0.0j""
The Boolean value of an object that is not a value other than the one listed above is True, such as Non-empty, Non-zero, and so on. A user-created class instance whose Boolean value is False if nonzero (__nonzero__ ()) or length (__len__ ()) is defined and the value is 0.
Objects want to wait for judgment:
A is B #a和b是否是同一对象
This expression is equivalent to the following expression
ID (a) = = ID (b)
Python Object Basics