Python variable data and immutable data parsing

Source: Internet
Author: User

Python has different data types than C, including mutable and immutable)

All the variables in Python are reference values, that is, the variables point to their values by binding. Here, immutable refers to the immutable value. If you want to change an unchangeable variable, a new value is created to bind the variable to the new value. If the old value is not referenced, garbage collection is pending. Another feature of an unchangeable type is that it can calculate its hash value so that it can be further used as the dictionary key. When you operate an object on a mutable data, you do not need to apply for memory elsewhere. You only need to apply for (+/-) continuously after this object, that is, its address will remain unchanged, but the region will become longer or shorter.

Unchangeable types include: int string float tuple

Variable types include: List dict

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.