Some people will know that C, C ++ and other languages manage blocks by {}, while the new version of Python is managed by indentation, this indeed makes up for the shortcomings of the previous language. I believe many programmers have missed.
If the compiler or interpreter used is excellent, you can easily add missing {}. However, if this is not the case, I think you will start roaming in complicated code. Because, maybe your compiler will tell you an error message, and the location of this error may be about 108,000 miles away from the real error ).
In contrast, for the Python application scope that uses indentation management, programmers almost do not need to consider this issue. Second, the Python code that distinguishes blocks by indentation is much clearer in complicated nesting. The following comparison between Python and C ++ on nesting:
- #!/usr/bin/python
- #python source
- class python:
- def Hello(self):
- print 'Hello'
- def count(n):
- in=0
- while(in<=n):
- inin=in+1
- print in
-
- //buile by G++ or VC++
- //C++ Source
- #include <iostream>
- int main()
- {
- class python
- {
- public:
- void Hello(void)
- {
- cout<<"Hello"<<endl;
- }
- void count(int n)
- {
- int in=0;
- while(in<=n)
- {
- inin=in+1;
- cout<<in<<endl;
- }
- }
- };
- return 0;
- }
In comparison, Python code can be further divided into different levels, while C ++ code can be compiled successfully. However, future maintenance will cause endless pain. At the same time, when I wrote C ++ Source, I almost missed it };. The Python syntax is concise. At the same time, he has a very strong ability to make mistakes. In general, the Python interpreter can accurately identify the location and cause of the error. The following code:
- #!/usr/bin/python
- #python source
- class python:
- def Hello(self):
- print 'Hello'
- def count(n):
- in=0
- while(in<=n):
- inin=in+1
- print in
-
- //buile by G++ or VC++
- //C++ Source
- #include <iostream>
- int main()
- {
- class python
- {
- public:
- void Hello(void)
- {
- cout<<"Hello"<<endl;
- }
- void count(int n)
- {
- int in=0;
- while(in<=n)
- {
- inin=in+1;
- cout<<in<<endl;
- }
- }
- };
- return 0;
- }
It is easy to see the cause and location of the error. In this mechanism, when you debug complex programs, you do not have to worry about the inability to quickly solve the problem. You only need to follow the Python error prompt and correct it step by step. For Python applications.
I personally divide it into several categories. The first class is software, which should be clear to everyone. Compared with C ++ and other languages, Python has the advantage of rapid development and code opening. For Python, you can open a notepad or Kwriter to write code, save it, and run it. Even complex code. This greatly reduces the development cycle and speeds up development.
Compared with traditional editing, compilation, and connection operations. Python is less troublesome. Three steps and two steps. Because of Python's concise code and short training time, it is very easy to develop and maintain software.
The Python code is interpreted as follows: After Python is installed, Python does not have to be installed for Python software. It's okay to run the software directly. For developers, product updates and fixes are easier.
- Important factors affecting the development of Python
- Details about the status of the Python Virtual Machine
- How to distinguish Python threads correctly
- Analysis on Python virtual machine execution framework
- Introduction to the Python runtime environment in the Python Virtual Machine
Maybe you only need to spend time browsing a web page to fundamentally fix bugs in the product. Thanks to Python code reuse and flexible code management. For errors that occur at the user end, developers can diagnose errors that come with the Python application scope.
Moreover, there are a lot of Python-related code libraries on the Internet, and these are free of charge. For Development enterprises, it can save a considerable amount of development money. Therefore, Python has its own characteristics and market in the software market.