18.3.5 python definition of variables, 18.3.5python

Source: Internet
Author: User

18.3.5 python definition of variables, 18.3.5python

The definition of python variables is quite different from that of C.

C language variables:

Int I = 6

Python variable usage:

I = 4

A c-language variable must first declare the type of the variable and assign values to it. The underlying hardware layer refers to the division of a space (variable name) in the memory space, the size is related to the data type, and then the data is placed.

This series of processes ensures security first. Although syntactically complicated, it saves more space than python, because the C language divides the required memory space based on the size required by each variable.

The syntax of variable definition in python is more like Paster. The constant on the right of the value assignment statement is stored in the memory space. The variable name defined is equivalent to sticking to the constant, the data type does not need to be declared. What is more different from the C language is that the object assigned by python is not limited to the Data Type of the value assignment content, that is to say, the same variable can be "pasted" on the string and "pasted" on the integer. However, the content assigned by each sentence is stored in different locations in the memory, and the logical statement compares the data size.

For example, and compares whether the expressions on both sides are both true and true returns true.

Is to compare whether the locations in the memory are the same

 

Related Article

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.