Python basic data type--int

Source: Internet
Author: User
The range of int python2: On a 32-bit machine, the number of integers is 32 bits, and the value range is -2**31~2**31-1;
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1;python3:

Theoretically the length is infinite (as long as the memory is large enough)

Second, Python memory mechanism

In general, when a variable is assigned, the relationship between the memory and the variable is as follows:

Special cases:

The optimization mechanism within Python (either 2.7 or 3.5):

-5 to 257, if the first assignment is used, then they are still in the same block of memory (can be viewed with ID)

Third, the source code int small Knowledge Point:

In the Python2:

Test = 9/2 Output--4from __future__ import divisiontest = 9/2 output--4.5

And in the Python3:

Test = 9/2 Output--4.5

Python basic data type--int

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.