Learn about Python

Source: Internet
Author: User
Tags lua

Python Introduction


Python is an interpreted language in a high-level language


1,The origin of Python


The founder of Python is Guido van Rossum (Guido van Rossum). During the Christmas of 1989, Guido began to write the Python language compiler. The name Python, from Guido's beloved TV show Monty Python's Flying Circus. He hoped that the new language, called Python, would fit his ideals: create a language that is all-powerful, easy to learn, easy to use, and extensible, between C and Shell.


2. Application fields of Python

Web Development --the most popular Python web framework Django, supports asynchronous high concurrency Tornado framework, dapper Flask,bottle, Django's official banner defines Django as the framework for Perfectionist with deadlines (to the effect that a highly efficient web framework developed for the full-person)


Network Programming -Support for high-concurrency Twisted Network framework, PY3 introduced Asyncio makes asynchronous programming very simple


Reptile -reptile field, Python is almost the supremacy, Scrapy\request\beautifusoap\urllib, and so on, want to climb what to climb what


Cloud Computing --The most popular cloud computing framework of the Openstack,python is now the fire, a big part of it is the cloud


AI -who will be the first language of development in the AI and Big data era? This is a question that is not to be debated. If there were opportunities for Matlab, Scala, R, Java, and Python three years ago, and the situation is unclear, three years later, the trend is clear, especially after Facebook open source Pytorch two days ago, Pyt

The position of Hon as the top language of AI era is basically established, the future suspense is only who can sit the second seat.

automated Operations -ask each of China's operations personnel what language is required for operations personnel? 10 people believe will give you the same answer, its name is Python


Financial Analysis -Python is by far the most used language in financial analysis and quantitative trading


Scientific Computing --you know, since 97, NASA has been using Python for a variety of complex scientific operations, with the development of NumPy, SciPy, Matplotlib, Enthought Librarys and many other libraries, Python is becoming more and more suitable for scientific calculations and for drawing high-quality 2D and 3D images. Compared with the most popular business software matlab in the field of scientific computing, Python is a universal programming language that is more widely used than the scripting language used by MATLAB.


game development -Python also has many applications in online game development. Compared to LUA or C++,python has higher-order abstraction than Lua, you can describe game business logic with less code, and Python is more appropriate as a Host language than Lua, where the entry point for a program is better at the end of the Python, and then C/s is used in non- Write some extensions when it's often necessary. Python is great for writing more than 10,000 lines of projects, and it's a good way to control the size of online games within 100,000 lines of code. In addition, as far as I know, the well-known game < Civilization > is written in Python.


3.python type


The code wants to run, must be executed through the interpreter, the Python interpreter itself can also be seen as a program (the translator is not what the country is not important), what language development of this program? The answer is in several languages.

Because Python has several kinds of interpreters that are developed in different languages, each with different features, but all of which can run our Python code properly.


CPython

When we downloaded and installed Python 2.7 from the official Python website, we immediately got an official version of the interpreter: CPython. This interpreter was developed in C language, so called CPython. Running Python at the command line is the start of the CPython interpreter.

The CPython is the most widely used Python interpreter. All the code for the tutorial is also executed under CPython.


IPython

Ipython is an interactive interpreter based on CPython, meaning that Ipython is only enhanced interactively, but the functionality and CPython of executing Python code are exactly the same. Like many domestic browsers although the appearance of different, but the kernel is actually called ie.

CPython uses >>> as a prompt, while Ipython uses in [ordinal]: as a prompt.


PyPy

PyPy is another Python interpreter whose goal is to perform speed. PyPy uses JIT technology to dynamically compile Python code (note that it is not interpreted), so it can significantly improve the execution speed of Python code.

Most python code can run under PyPy, but PyPy and CPython are somewhat different, which results in the same Python code being executed under both interpreters. If your code is to be executed under PyPy, you need to understand the differences between PyPy and CPython.


Jython

Jython is a Python interpreter running on the Java platform that compiles python code directly to Java bytecode execution.


IronPython

IronPython is similar to Jython, except that IronPython is a Python interpreter running on the Microsoft. NET platform that compiles python code directly into. NET bytecode.


3. execution of Python


1. File Execution

Python py Script Path

To perform the steps:

1. Start the Python interpreter first

2.python interpreter reads the contents of the file from the hard disk into memory

3. After reading into memory, explain the execution

Pros: Permanently Save code

Cons: cannot invoke code immediately


2. Interactive execution

Python interactivity is used primarily for debugging code.

Pros: Instant debug Program, debugging method

Cons: Unable to permanently save code

3. Notes

A. Comment function:

Increase the readability of your code

(Generally speaking is to let others understand your code is why, can be used to install B, of course, the time has long been forgotten)


B. There are two types of annotations:

Single-line comment: Add # directly at the beginning

Multiline comment: three pairs of double quotation marks "" "" ""


C. Code comment principle:

Instead of annotating them all, just add a comment to the part you think is important or not understandable.

Comments can be in Chinese or English, but definitely not pinyin oh


This article is from the "Lyndon" blog, make sure to keep this source http://lyndon.blog.51cto.com/11474010/1946060

Learn about Python

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.