Python variable and immutable types

Source: Internet
Author: User

Length summarize the basics of Python, write a write not easy to forget

* Python data types can be divided into variable and immutable type two categories

Mutable type: list, dictionary

Immutable types: Numeric, character, tuple

* When an immutable type is assigned, a new immutable object is created, and a variable pointing to the original immutable object points to the new immutable object, which loses the variable that points to it, and the immutable object is recycled if no new variable points to it.

eg

1 i=12 i+=13i4 2

Instead of actually adding 1 to the original int object, the i+=1 here re-creates a 2 object and references I to this object

Python variable and immutable types

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.