First knowledge of Python (1)

Source: Internet
Author: User

Basic Concepts

Python is an object-oriented, literal translation computer programming language, invented by Guido van Rossum at the end of 1989. The first public release was released in 1991. Python syntax is simple and clear, with a rich and powerful class library. It is often nicknamed the Glue language, which makes it easy to easily connect a variety of modules (especially C + +) made in other languages. A common application scenario is to use Python to quickly build a prototype of a program (sometimes even the final interface of the program), and then rewrite it in a more appropriate language with the parts that are specifically required. For example, 3D game Graphics rendering module, speed requirements are very high, can be rewritten in C + +.

Key Features

Simple: Python is a language that represents the idea of simplicity. Reading a good Python program feels like reading English. It allows you to focus on solving problems rather than figuring out the language itself.

Easy to learn: Python is extremely easy to get started because Python has a very simple syntax.

Free, open Source: Python is one of floss (free/open source software). The user is free to publish copies of the software, read its source code, make changes to it, and use it as part of the new free software. Floss is the concept of sharing knowledge based on a group.

High-level languages: When writing programs in the Python language, you don't have to consider the underlying details such as how to manage the memory used by your program.

Portability: Because of its open source nature, Python has been ported on many platforms (modified to make it work on different platforms). These platforms include Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, as/400, BeOS, os/390, z/OS, Palm OS, QNX, VMS, Psion, Acom RISC OS, VxWorks, PlayStation, Sharp Zaurus, Windows CE, PocketPC, Symbian, and Google Linux-based Android platforms.

Explanatory: A program written in a compiled language, such as C or C + +, can be converted from a source file (that is, C or C + +) to a language used by your computer (binary code, 0 and 1). This process is done through the compiler and different tags and options.

When you run the program, the connection/reprint software copies your program from the hard disk into memory and runs. Programs written in the Python language do not need to be compiled into binary code. You can run the program directly from the source code.

Inside the computer, the Python interpreter translates the source code into an intermediate form called bytecode, and then translates it into the machine language used by the computer and runs it. This makes it easier to use Python. It also makes Python programs easier to migrate.

Object-oriented: Python supports both process-oriented programming and object-oriented programming. In a "process-oriented" language, a program is built from a procedure or simply a function of reusable code. In "Object-oriented" languages, programs are built from objects that combine data and functionality.

Extensibility: If you need a piece of critical code to run faster or you want some algorithms to be private, you can write some programs in C or C + + and then use them in a Python program.

Embeddable: Python can be embedded in a C + + program to provide scripting functionality to program users.

Rich Library: The Python standard library is really huge. It can help with all kinds of work, including regular expressions, document generation, unit tests, threads, databases, Web browsers, CGI, FTP, e-mail, XML, XML-RPC, HTML, WAV files, cryptography systems, GUI (graphical user interface), TK, and other system-related operations. This is called Python's "fully functional" concept. In addition to the standard library, there are many other high-quality libraries, such as Wxpython, twisted, and Python image libraries, and so on.

Canonical code: Python uses forced indentation to make the code more readable. Programs written in the Python language do not need to be compiled into binary code.

Advantages

Python is an unrestricted, cross-platform, open-source programming language that is powerful and easy to learn. So it has been widely used and supported.

Python was introduced in the ArcGIS 9.0 community. Since then, Python has evolved as a scripting language for geoprocessing users to choose from. Each release further enhances the Python experience, giving you more functionality and a richer, more friendly python experience.

ESRI has fully incorporated Python into ArcGIS as a language to meet the needs of our user community. Here are just some of the benefits of Python [1]:

    • Easy to learn, ideal for beginners, and especially suitable for use by experts
    • Highly scalable, suitable for large projects or small one-time programs (called scripts)
    • Portable, cross-platform
    • Embeddable (enables ArcGIS to be scripted)
    • Stable and mature
    • Large User Community Size

Python has been extended to ArcGIS as a language for data analysis, data transformation, data management, and map automation, thus helping to increase productivity.

Limitations

Forced indentation: This may not be called a limitation, but it is also confusing for many beginners by indenting the way in which the statement relationship is differentiated.

Single-line statements and command-line output problems: Many times you cannot write a program to a line, such as import sys;for I in Sys.path:print i. Perl and awk do not have this limitation, it is easier to complete a simple program under the shell, do not need to like Python, the program must be written to a. py file.

First knowledge of Python (1)

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.