Python Road "First article": Python Introduction and Getting Started

Source: Internet
Author: User

Introduction to Python:

What is Python

Python (United Kingdom pronunciation:/paθn/American pronunciation:/paθɑn/), is an object-oriented, literal translation of computer programming language.

Each language has its own philosophy:

Pythonde design philosophy is: "Elegant", "clear", "simple"

Python origin

During the Christmas of 1989, Guido van Rossum to spend time in Amsterdam, determined to develop a new script interpreter, as an inheritance of the ABC language. Python was chosen as the name of the program because he was a fan of the BBC TV show-Monty Python's Flying Circus (Monty Python's Flying Circus).

What Python can do

Web Program

Python is often used for web development. For example, with the Mod_wsgi module, Apache can run web programs written in Python. Gunicorn, written in the Python language, is also capable of running web programs written in the Python language as a Web server. Python defines the WSGI standard application interface to coordinate the communication between the HTTP server and the Python-based Web program. Some web frameworks, such as Django, Pyramid, TurboGears, Tornado, Web2py, Zope, and flask, can make it easy for programmers to develop and manage complex web programs.

Python's support for various network protocols is perfect and is often used to write server software and network worms. The third-party library twisted supports asynchronous online authoring programs and most standard network protocols (including clients and servers), and provides a variety of tools that are widely used to write high-performance server software. Another gevent, the popular third-party library, is also capable of supporting high-performance, highly concurrent network development.

GUI Development

Python itself contains a tkinter library that supports simple GUI development. But more and more Python programmers choose GUI packages such as Wxpython or PYQT to develop cross-platform desktop software. Desktop software that is developed with them runs fast and matches the user's desktop environment. You can also publish a program as a standalone installation package through Pyinstaller.

Operating system

In many operating systems, Python is the standard system component. Most Linux distributions, as well as NetBSD, OpenBSD, and Mac OS X, are integrated with Python, which can be run directly under the terminal. Some installers for Linux distributions are written in Python language, such as Ubuntu's ubiquity installer, Red Hat Linux, and Fedora's Anaconda installer. Gentoo Linux uses Python to write its Portage package management system. The Python standard library contains several libraries that invoke the functionality of the job system. By Pywin32 This third-party package, Python has access to Windows COM services and other Windows APIs. Use the Ironpython,python program to directly invoke the. Net Framework.

Other

NumPy, SciPy, matplotlib can allow Python programmers to write scientific computing programs. Some companies use scons instead of make to build C + + programs.

Many games use C + + to write high-performance modules such as graphical display, while using Python or Lua to write game logic, servers. Compared to Python,lua, the functionality is simpler and smaller, while Python supports more features and data types. Many games, such as Eve Online, use Python to handle a variety of logic in the game.

YouTube, Google, Yahoo!, and NASA all use Python in their own way. Most of the software for the Sugar project is written using Python


So his range of applications is roughly divided into:

Data analysis

System programming

Component integration

Network Services

Image processing

Numerical calculation and scientific calculation


Design philosophy and Orientation

Python's design philosophy is "elegant", "clear", "simple". The Python developer's philosophy is "in one way, it's best to have only one way to do something." When designing the Python language, Python developers tend to reject the fancy syntax when faced with a variety of choices, and choose a syntax that is unambiguous or rarely ambiguous. These guidelines are called "Python maxims." Run import this in the Python interpreter to get a complete list


1. Beauty is better than ugliness (Python aims to write graceful code)

2. Clarity is better than obscure (graceful code should be clear, naming specification, style similar)

3. Simplicity is better than complexity (beautiful code should be concise, don't have complex internal implementations)

4. Complexity is better than messy (if the complexity is unavoidable, the code can not be difficult to understand the relationship, to keep the interface concise, more comments!) )

5. Flat is better than nesting (graceful code should be flat, not too much nesting)

6. The interval is better than the compact (graceful code has the appropriate interval, do not expect a line of code to solve the problem, a line of code can not exceed 80 characters, you can change line or start a new logic to write)

7. Readability is important (graceful code is readable)

8. Even in the name of the practicality of the special case, the rules must not be violated (these rules are paramount), and it is not permissible for a special column to follow this rule

9. Do not tolerate all errors unless you are sure you need to (catch exceptions accurately, do not write Except:pass-style code)

10. When there are many possibilities, don't try to guess!

11. Instead try to find one, preferably the only obvious solution (if unsure, use the brute-lifting method)

12. Although this is not easy, because you are not the father of Python (here Dutch refers to Guido)

13. It may be better not to do it, but it's better not to do it without thinking about it (before you do it)

14. If you can't describe your plan to someone, it's certainly not a good plan; and vice versa (Programme evaluation criteria)

15. Namespaces are a wonderful idea, and we should use them more (advocacy and calling


Ps:

Simply compare PHP with Python:

Python is a comprehensive language, and he can not only do web development. The contrast between them should be limited to web development directions. Don't see its phpweb development don't python good, PHP is preconceived, Python's web frame is only a bit late in 2000.

Django got up late, and their web development was pretty good. You can do all of the python you do with PHP. Python gives you a complete solution, both front-end and back-end can be used with Python.

Simply take C and python for comparison:

Python slow, slow serious, slow out of style, slow from the letter!!! The same program Python is hundreds of times times slower than C is normal.

The speed of the program to a large extent programmer logic, SQL, algorithm, compared to O (n) and O (n^2) differences, the difference between the language is very small



This article is from the "Vibrating Heartstrings" blog, please be sure to keep this source http://shuainotebook.blog.51cto.com/1271282/1706126

Python Road "First article": Python Introduction and Getting Started

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.