Object of Python

Source: Internet
Author: User

All Python objects have three properties: identity, type, and value

Identity:
Each object has a unique identity that identifies itself, and any object's identity can be obtained using the built-in function ID ().

Once a Python object is created, it cannot change its identity type. Changing an object means creating a new object and changing the reference.


Object:
The type of object determines what type of value the object can hold, what actions can be taken, and what rules to follow. The type of Python object can be viewed with the built-in function type ()
Because types are also objects in Python, type () returns an object instead of a simple string.


Value:
object represents the data item.

If an object supports an update operation, its value can be changed, otherwise its value is read-only. Whether the value of the object can be changed to be known as the object's change (mutability)


Standard type operators

Object value Comparison:

= =, >, <, etc.

Object Identity Comparison:

Obj1 is obj2, obj is not obj2

>>> a = 4.3>>> B = 4.3>>> a==btrue is bfalse

Boolean type:

Not, and, or

Standard type built-in functions

Type (obj), CMP (OBJ1, OBJ2), str (obj), repr (obj)

2015-05-25

Object of Python

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.