Chapter 4 python objects and Chapter 4 python objects
4.1 Python object
All Python objects have three features: identity, type, and value.
Identity:
Each object has a unique identity. You can use the built-in function id () to identify any object. This value can be considered as the memory address of the object. This value is rarely used, and you don't have to worry too much about what it is.
Type
The object type determines what type of value the object can save, what operations it can perform, and what rules it follows. You can use the built-in function type () to view the Python object type. Because the type in Python is also an object
(Do you still remember to mention that Python is object-oriented ?), Therefore, type () returns an object instead of a simple string.
Value
Data represented by objects
4.1.1 Object Attributes
Some Python objects have attributes, values, or associated executable code, such as methods ). Python uses the dot (.) flag to access attributes. Attributes include the name of the corresponding object, which has been described in the remarks in section 2.14. Most common
The attributes are functions and methods, but some Python types also have data attributes. Objects containing data attributes include (but are not limited to) classes, class instances, modules, plural numbers, and files.
4.2 standard type