Python has been born for more than 20 years now, but Python is still one of the most popular programming languages, with Python developed in many platforms. Table 1-1 shows the March 2017 and March 2018 programming language rankings published by the Tiobe community, which shows the popularity of the Python language, perhaps the main reason many people choose to learn Python.
Python language history
Guidovan Rosum, the father of Python, Dutch, Guido van.
Rossum) during Christmas 1989, in Amsterdam, was determined to develop an interpretive language in order to spend the boring time of Christmas. 1991 the first Python interpreter was released in public, it was written in C and was able to invoke the C language library file. Python has been born with classes, functions and exception handling content, including dictionaries, lists and other core data structures, as well as module-based expansion system.
2000 Python 2.0 released, Python 2
The last version is 2.7, it will be there for a long time, Python
2.7 Support time extended to 2020 years. 2008 Python 3.0 released, to this book when writing Python
3.6 Release, note that this book was written based on Python version 3.6. Python 3 and Python
2 is incompatible, because many Python programs and libraries are based on Python 2, so Python 2 and Python
3 programs will coexist for a long time, but Python
3 of new features have attracted many developers, many of whom are upgrading from Python 2 to Python
3. As a beginner if learning python should start with Python 3.
Python word translation "Python", think of this animal will not have a very pleasant feeling. So why is this new language named Python? That's because Guido likes watching British TV shows Monty Python's Flying Circus (Monty
Python's Flying Circus), so he named the new language Python.
The Zen of Python language design philosophy--python
The Python language has its design philosophy and philosophy, called "The Zen of Python".
Python's Zen is the soul of Python, and understanding the Zen of Python can help developers write good python programs. Enter import in the Python interactive mode run tool idle
The This command, shown in 1-1, is the Zen of Python.
The Python Zen translation is interpreted as follows:
The Zen of Python by Tim Peters
Beauty is better than ugliness
Clarity is better than obscurity
Simplicity is better than complexity
Complexity is better than clutter
Flat is better than nesting
Looser than compact
Readability is important
Even if it is a special case, it must not violate these rules
Do not catch all errors unless you are sure you need to do so
If there are multiple possibilities, don't guess
Usually only the only one is the best solution
Although this is not easy, because you are not the father of Python
It's better to do than not to do it, but it's better not to do it without hesitation.
If your plan is difficult to understand, it's definitely not a good plan, and vice versa.
Namespaces are very useful and should be used more
Python language Features
Python language can be popular and long-lasting, thanks to the Python language has a lot of good key features. These features are as follows:
- Easy and easy to learn
One of the Python design goals is easy to learn and easy to use. It allows you to focus on solving problems rather than focusing too much on the language itself.
- Object oriented
Python supports object-oriented programming. Python implements object-oriented programming in a very powerful and simple way, compared to other major languages such as C + + and Java.
- Explanatory nature
Python is interpreted as executing, that is, the Python program does not need to be compiled into binary code and can run the program directly from the source code. Inside the computer, the Python interpreter converts the source code into an intermediate bytecode form, which is then interpreted as the machine language used by the computer and executed.
- Free Open Source
Python is one of the free open source software. Simply put, you are free to publish a copy of the software, read its source code, make changes to it, and use it as part of the new free software.
- Portability
The Python interpreter has been ported on many platforms, and Python programs can run on multiple platforms without modification.
- Glue language
Python is known as the glue language, which is used to connect software components or modules written in other languages. Python can be called glue language because the standard version of Python is compiled with C, called CPython. So python can invoke the C language, with the help of the C interface Python can drive almost all known software.
- A rich library
Python's standard library (officially available) offers a wide variety of tasks that can help with a variety of jobs, which do not require installation to be used directly. In addition to the standard library, there are many other high-quality libraries available.
- Code of the specification
Python uses forced indentation to make the code extremely readable.
- Supports functional programming
Although Python is not a purely functional programming, it also provides support for functional programming, such as function types, lambda expressions, higher-order functions, and anonymous functions.
- Dynamic type
Python is a dynamic type language, it does not check the data type, and the variable declaration is not required to specify the data type.
Application foreground of Python language
Python, like the Java language, is a high-level language that does not have direct access to hardware and can not be compiled to run on-premises code. In addition, Python can do almost anything. The following are the main application scenarios for the Python language:
- Desktop application Development
The Python language can develop traditional desktop applications, and Python libraries such as Tkinter, PyQt, Pyside, Wxpython, and PYGTK can quickly develop desktop applications.
- Web application Development
Python is also often used for web development. Many sites are based on Python
Web development, such as watercress, know-how and Dropbox. A lot of mature python
Web frameworks, such as Django, Flask, Tornado
, bottle, and web2py Web frameworks. Can help developers quickly develop web apps.
- Automated operation and Maintenance
Python can write server operations automation scripts. Many servers use Linux and UNIX systems, and many operators have previously written system Management shell scripts to achieve operational operations. Now using Python to write system management is better than ordinary shell scripts in terms of readability, performance, code scalability, scalability, and so on.
- Scientific calculations
Python language is also widely applied in the calculation of science, NumPy, scipy and pandas are excellent numerical computing and scientific Computing library.
- Visualization of data
The Python language can also be used to display complex data through graphs for easy data analysis. The Matplotlib library is an excellent visual library.
- Web crawler
The Python language has long been used to write web crawlers. Google and other search engine companies use Python language to write a large number of web crawlers. Technically speaking, the Python language has many of these tools, Urllib, Selenium, and BeautifulSoup. You can also scrapy the Web crawler framework.
- Artificial intelligence
AI is now a very fire in the direction. Python is widely used in the direction of deep learning, machine learning, and natural language processing. Due to the dynamic nature of the Python language, many AI frameworks are implemented using Python language.
- Big Data
Large data analysis involves distributed computing, data visualization, database operations, and so on, Python has a mature library to do these things. Both Hadoop and Spark can write calculation logic directly using Python.
- Game development
Python can directly invoke the open
GL implements 3D rendering, which is the technical foundation of a high performance game engine. All of the many Python languages implement game engines such as Pygame, Pyglet, and cocos2d.
How to get Help
For a beginner you must be familiar with the following Python-related URLs:
Python Standard library: https://docs.python.org/3/library/index.html
Python howto:https://docs.python.org/3/howto/index.html
Python Tutorial: https://docs.python.org/3/tutorial/index.html
PEP Specification [^1]:https://www.python.org/dev/peps/
[^1]: Pep is Python enhancement
Proposals's abbreviation. PEP is a technical specification that provides a variety of enhancements to the Python community, and is also a proposal for submitting new features to let communities point out issues and refine technical documentation.
Companion video
Http://edu.51cto.com/topic/1507.html
Supporting source code
Http://www.zhijieketang.com/group/8
Ebook
Https://yuedu.baidu.com/ebook/5823871e59fafab069dc5022aaea998fcc2240fc
Author Micro-blog: @tony_ dongsheng br/> Email:[email protected]
Python Reader service QQ Group: 628808216
"Python from small white to Daniel," The 1th chapter begins to summarize