None and null in python

Source: Internet
Author: User
1. to understand Python objects, first understand Python objects: python objects have three features: Identity, type, and value. Three features are assigned a value when an object is created. Only values can be changed. other values are read-only. The type itself is also an object. 2. Null and None are special types of Python. a Null object or NoneType has only one value, None. it does not support any operations or any built-in methods. if None is compared with any other data type, False is always returned. None has self... 1. Python object

To understand this, first understand the Python object:

Python objects have three features: Identity, type, and value.

Three features are assigned a value when an object is created. Only values can be changed. other values are read-only.

The type itself is also an object.

II. Null and None

Is a special Type of Python, Null object or None Type, it has only one value None.

It does not support any operations or any built-in methods.

If None is compared with any other data type, False is always returned.

None has its own data type NoneType.

You can copy None to any variable, but you cannot create other NoneType objects.



>>> Type (None)

>>> None = 0
False
>>> None =''
False
>>> None = None
True
>>> None = False
False

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.