1-Understanding Python

Source: Internet
Author: User

Why use Python:

    • Software quality:

Read/write, consistency, software quality
Advanced reuse mechanism to support software development

    • Provide developers with efficiency:

Code is only Java or C + + 1/5~1/3
No need to compile links, improve the efficiency of Cheng

    • Portability of the program:

User image interface, database access, Web-based systems, etc.

    • Support for standard libraries:
    • Component integration:

You can call a C or C + + library
Can be called by C and C + + programs
can be integrated in Java components

Software quality:

Concise and highly readable syntax
Minimalist design philosophy: Although there are often many ways to implement a programming task, there are often only one way to be clear
Python uses some tools, including modular design and OPP, to prompt the reusability of programs

Development efficiency:
Python takes less effort to complete more tasks
Concise syntax, dynamic type, no compilation, built-in toolkit

is Python "scripting language":
Python is a multi-purpose programming language, often playing the role of scripting language
Python can be defined as an object-oriented scripting language
People tend to describe Python code files as "scripts" rather than "programs"
"Scripts" tend to describe simple top-level code files
"Program" is used to describe a relatively complex number of files

There are three different roles for Python:

    • Shell tools:

Implements tasks such as processing text files and invoking other programs
Python is more than just a good shell scripting language

    • Control statements:

When testing a hardware device, the application can invoke Python code without having to distribute or recompile the entire system code

    • Quick use:

Python's ease-of-use and flexibility make programming tasks easier
Often used for fast job tasks and long-term strategy development

What are the disadvantages of Python:
Python does not compile the code into the underlying binary code, and the Python program will be slower than a fully compiled language like C
The benefits of Python development speed are often more important than the loss of execution speed, and modern CPUs are getting faster

What to do with Python:

    • System Programming:

Python's built-in interface to operating system services makes it an ideal tool for writing portable management tools and parts (shell tools) that maintain operating systems
Python programs can search for files and directory trees, run other programs, process or thread parallel processing, etc.
Python's standard library binds POSIX and other general operating system (OS) Tools: Environment variables, files, sockets, pipelines, processes, multithreading, regular expression pattern matching, command-line arguments, standard stream interfaces, shell command initiators, file name extensions, and more

    • User Image interface:

Python has built-in Tkinter's standard object-oriented interface tk GUI API, enabling Python programs to generate portable, native-looking GUI

    • Internet scripts:

Python provides a standard Internet module that can be used extensively in a variety of network tasks
Scripts can communicate via sockets, transfer files via FTP, get web pages via URLs, communicate via XML-RPC, soap and Telnet, and more

    • Component integration:

Python can be extended through a C + + system with the ability to nest features of A/C + + system
Embed python in the product to allow individual customization of the product without recompiling the entire product or the source code

    • Database programming:

Python provides an interface to all major relational databases

    • Rapid prototyping:

The components written in Python or C all look the same, and you can use Python to prototype the system at the outset and then port the component to a compiled language such as C or C + +. Python does not need to be rewritten when the prototype is determined

    • Numerical computation and scientific calculation programming:

Python provides interfaces to matrix objects, standard math libraries

    • Games, images, artificial intelligence, XML, robotics, etc.

Use Python to program graphics games using the Pygame system
Interface communication on Windows, Linux, and more systems with psserial extensions
Image processing with PIL, Pyopengl, Blender, Maya, and other tools
XML parsing with XML libraries, xmlrpclib modules, and other third-party extensions
......

Python has some of the technical advantages:

    • Object-oriented:

Python is an object-oriented language that supports advanced concepts such as polymorphism, operator overloading, and multiple inheritance

    • Free:

Python is completely free to use and distribute.

    • Portability:

The standard implementation of Python is written by the portable ANSI C
Python can run on the following platforms:
Linux and UNIX, Windows and DOS, Mac OS, BeOS, and more

    • Powerful features:

Python is a hybrid, rich in tools that make it between traditional scripting languages (TCL, Perl) and system languages (c, C + +)

      • Dynamic Links:

Python keeps track of the kinds of objects at any time during the run, without requiring the code to declare complex types and sizes

      • Automatic memory Management:

Python automatically assigns objects and automatically revokes objects when they are no longer in use ("garbage collection")

      • Large Program Support:

To be able to build a larger system, Python contains modules, classes, and exception handling tools

      • Built-in Object types:

Python provides common data structures as a basic part of the language, such as: List, dictionary (dictionary), string

      • Built-in Tools:

Python comes with many powerful standard operations, including merging (concatenation), sharding (slice), sorting (sort), and mapping (mapping)

      • Library Tools:

Python presets A number of pre-compiled library tools, from regular expression matching to network support

      • Third-party tools:
    • Can be mixed:

Python's C language can help Python programs to invoke C programs flexibly
Python is a mix of library files written in C or C + +, making Python a front-end language and custom tool

    • Simple to use:

Run a Python program to simply type the Python program and run it, without the intermediate steps such as compiling and linking required by other languages

    • Easy to learn:

The core of the Python language is very simple and easy to learn

Python eggs:
To understand the complete philosophy of Python, type the import this command in any Python interaction interpreter. Describes a series of Python design principles

Python is engineering, not art:
The creator of Python is trained by mathematicians, and Python is like math, and its design is orthogonal (orthogonal), for example: moving to Master Python's polymorphism, leaving only the details.
Writing unique, skillful code, often a source of pride between Perl users, Perl is a descriptive language
Python is best for Perl's description language: Python's syntax model almost forces the user to write readable code that can be used for a long time after it is first written

1-Understanding Python

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.