Cpy and Python efficiency comparison, CpyPython Efficiency
Beginners of the Python language, especially the "surprise" (that is, those who are initially attracted by meaningless features and will continue to convince themselves) I think Python does not need C-language for statements, because they can replace C-class for with elegant Python.
Cpy cycle:
Copy codeThe Code is as follows:
For (I = s; I <num; I + = step ){
}
Python cycle:
Copy codeThe Code is as follows:
For I in range (num) [s: e: step]:
Recently, I wrote a code that repeats 100000000 times. Unfortunately (and as expected), Python eats up the machine memory, and let my Windows report the error of insufficient virtual memory. poor Python can only be killed by the operating system without any chance.
The Cpy cycle is not under pressure and only occupies a small amount of memory.