SoFunction
Updated on 2024-11-19

Getting Started with Python Page 1/10

Chapter I. Introduction
Scripting languages are similar to DOS batch processing and UNIX shell programs. Scripting languages do not need to be compiled and then executed each time, and in the execution of the program can easily access the running program, and even can dynamically modify the running program, suitable for rapid development and to complete some simple tasks. When using a scripting language, new functionality is often required, but sometimes it cannot be implemented because the scripting language is already slow, large, and complex; or the functionality required involves system calls or other functions that can only be provided in C-usually the problem to be solved is not so important that it must be rewritten in C. Or, the problem requires something like variable-length program memory, which can be easily accessed during execution, or even dynamically modified in a running program; Or, the problem requires data types such as variable-length strings (e.g., ordered lists of filenames), which are easy to implement in a scripting language and require a lot of work to implement in C; or, the programmer is unfamiliar with C: in these cases, it is still possible to use a scripting language.

In such a case, Python may be just right for your needs.Python is simple to use, but it's a real programming language and offers more structure and support for larger programs than the shell. On the other hand, it offers more error checking than C. It's a very high-level language with a variety of built-in high-level data structures, such as flexible arrays and dictionaries, that could take you days to implement efficiently with C. Because Python has more general data structures, it is more widely applicable than Awk or even Perl, and many things are at least as easy to do within Python as they are within those languages.

 

Python allows you to break down programs into modules, which can be reused in other Python programs. It comes with a large set of standard modules that can be used as the basis for your own programs - or as examples for learning Python programming. The system also provides stuff about file input and output, system calls, sockets (sockets), and even provides a generic interface to the windowing system (STDWIN).

 

Python is an interpreted language that saves a lot of time in program development because it does not require compilation and linking. Interpreted programs can be used interactively, making it easy to experiment with various features of the language, to write one-time-only programs, or to test functions in bottom-up program development. It is also a handy calculator.

 

Python allows you to write very tight and readable programs. Programs written in Python are usually shorter than their C counterparts for several reasons:

  
Advanced data structures allow you to express complex operations in a single statement; the
Compound statements rely on indentation rather than using parentheses to indicate beginning and end; the
No variable declarations or parameter declarations are required.
Python is extensible: if you know how to program in C it's easy to add new built-in functions or modules to the interpreter so that you can perform critical operations as fast as possible, or link Python programs to libraries that are only available in binary code (such as graphics libraries from different vendors). When you get really good at it you can link the Python interpreter to an application written in C, using it as an extension or command language for that application.
Python was named after the BBC program "Monty Python's Flying Circus" and has nothing to do with pythons.
12345678910next pageRead more