Chapter 4 python objects and Chapter 4 python objects

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.