Python is developed in C language

Source: Internet
Author: User

Python is developed in the C language.

#c language, no Strings: strings using character groups to represent hello-five character array [' H ', ' e ',... ' o '] so if a string is modified in Python, it opens up a chunk of memory in memory. For example, hello to HELLOAA is not to [' H ', ' e ', ' l ' ..., O] after the array is added [A,a] But the memory opens up a space to rewrite the preceding Hello and add [A,a] that is: [' h ', ' e ', ' l ', ' a ', ' a '] So why not add, but re-open space? Because the memory usage address is contiguous. Suppose your string uses 1-n's memory address block, from N+1 is another address block that is used by other strings. You say how you add [A,a], memory address n has been used after. So the memory processing method is newly opened up a block of addresses that will precede the rewrite in addition to the required content. Conclusion: The modification of the string is actually a new piece of memory opened up. So programming in ' hello ' + ' world ' + ' ... ' Each of the + numbers will open up a new memory and consume memory. Low efficiency.

Python is developed in C language

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.