Python Object Learning

Source: Internet
Author: User
Introduction to Python objects

Python uses the object model to store data, and constructs any type of value as an object, although Python is used as an object-oriented programming language, but scripts that do not use any classes and instances are completely written. All Python objects have three properties: Identity, type, value

Identity:

Each object has a unique identity, and the identity of any object can be used with the built-in function ID (), which can be thought of as the memory address of the object, which you rarely use.

Type:

The type of the object determines what type of value the object can hold, what actions it can take, and what rules to follow, which can be used to view the type of the Python object using the built-in function type (), which is not a simple string returned by type ().

Value:

object represents the data item.

These three attributes are assigned when the object is created, except for the value, the other two features are read-only, and the type of the object can be changed for the new type and class.

Can the value of an object be changed?

A: If the object supports the update operation, then its value can be changed, otherwise it is read-only, whether the value of the object can be changed to be called a mutability, Python has a series of data types, if necessary, you can customize the creation of custom types to meet your needs.

Properties of the Object

Some Python objects have properties, values, or related executable code, such as methods, that use. To access the properties of an object, including the name of the object, and the objects that contain the data properties include:

Class, instance, module, plural, file

  

Python Object Learning

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.