Python variable assignment with step-up explanation

Source: Internet
Author: User
This time to bring you a Python variable assignment of the step-by-bit details, the Python variable assignment of attention to what, the following is the actual case, together to see.

>>> x = 12>>> y= 13>>> ID (x) >>> ID (y) >>> x = y>>> ID (x) >>> ID (y)

The first assignment of the x variable to the 12,y variable is 13, and we use the ID (variable) to see where x and Y are in memory, respectively. The above shows 1865402384 and 1865402416 respectively. Then we make x = y, and then we look at where they are in memory and find that both X and Y point to 1865402416. Thus, in Python, the way we assign values differs from the C language, and C directly changes the value in X's memory, and Python directly changes the direction of X, which reminds me of pointers.

Let's try it and continue to enter the following code here

>>> y = 12>>> id (y) 1865402384

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

The Python interface uses the OpenCV method

Python configuration and the use of OPENCV

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.