Why programs written in the Python programming language are shorter than those written in the C program

Source: Internet
Author: User

Python makes the programming language a simple way to use, but the Python programming language is a real programming language, in addition, it provides more related structures and support for large programs than shell. The following describes the practical application of the Python programming language.

Python allows you to break down a program into modules, which can be reused in other Python programs. It carries a large number of standard modules that can serve as the basis of your own programs? Python programming example. The system also provides file input and output, system calls, sockets (sockets), and even General interfaces of the window system (STDWIN.

The scripting language is similar to DOS batch processing and UNIX shell programs. The script language does not need to be compiled and then executed every time, and can easily access the running program during execution, or even dynamically modify the running program, it is suitable for rapid development and completion of some simple tasks.

  • Detailed introduction to the execution scheme of Python programs
  • How to Set environment variables in Python
  • Python configuration operations and Applications
  • Detailed steps of the Python web development framework
  • Note the following in the 10.4 backup script code in the Python Tutorial:

New features often need to be added when using the script language, but sometimes the script language is already very slow, very large, and very complex and cannot be implemented; or, the required functions involve system calls or other functions that can only be provided by the C language. The problem to be solved is not important to the extent that the C language must be used for rewriting. Or, to solve the problem, data types such as variable-length strings, such as an ordered list of file names, are required ).

Such data types are very easy to implement in scripting languages, and C language requires a lot of work; or programmers are not familiar with C language: in these cases, the scripting language can still be used.

In this case, the Python programming language may be suitable for your needs. Python is easy to use, but it is a real programming language and provides more structures and support for large programs than shell.

On the other hand, it provides more error checks than C. It is a very advanced language with a variety of built-in advanced data structures, such as flexible arrays and dictionaries, it may take several days for these data structures to be implemented efficiently in C. Because Python has a more general data structure, it is wider than Awk or even Perl, and many things are at least as easy in Python as in these languages.

Python allows you to break down a program into modules, which can be reused in other Python programs. It comes with a large number of standard modules that can serve as the foundation of your own programs-or as an example of learning Python programming. The system also provides file input and output, system calls, sockets (sockets), and even General interfaces of the window system (STDWIN.

Python is an interpreted language, which saves a lot of time for program development because it does not require compilation and connection. The interpreter can interact with each other, so that you can easily test the features of the language, write a program only once, or test the function from the bottom up program development. It is also a convenient calculator.

Python allows you to write very rigorous and readable programs. Programs Written in the Python programming language are generally shorter than the corresponding C Programs, for the following reasons:

The advanced data structure allows you to use a statement to express complex operations;

Composite statements depend on Indentation rather than brackets indicating start and end;

Variable declaration or parameter declaration is not required.

The Python programming language is extensible: If you program in C, it is easy to add new built-in functions or modules to the interpreter, so that you can perform key operations as quickly as possible, or connect the Python program to a library that can only be provided by binary code, such as a graphics library provided by different vendors. When you get really running, you can connect the Python interpreter to an application written in C and use it as an extension or command language for the application.
 

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.