Fundamentally speaking ,Python It's an object-oriented language . Its class model supports polymorphism 、 Advanced concepts such as operator overloading and multiple inheritance , And take Python Unique concise syntax and types for the background ,OOP Very easy to use . in fact , Even if you don't understand these terms , You will still find learning Python Than learning other things OOP Language is much easier .
In addition to being a powerful means of code organization and reuse ,Python Of OOP Its nature makes it an ideal scripting tool for other object-oriented system languages . for example , With the appropriate bonding code ,Python The program can be used to C++、Java and C# Class for subclass customization .
OOP It's just Python Just a choice , This is very important . Even if you can't become an object-oriented expert right away , But you can also continue to learn more . It's like C++ equally ,Python It supports both object-oriented programming and process oriented programming patterns . If conditions permit , Its object-oriented tools can come in handy immediately . This is very useful for policy development patterns , This pattern is often used in the design phase of software development .
Except for the original process ( Statement based ) And object oriented ( Class based ) Programming paradigm ,Python Built in support for functional programming in recent years —— A generator is included in most cases 、 deduction 、 Closure 、 mapping 、 Decorator 、 anonymous lambda A collection of functions and first class function objects . This is for itself OOP Supplement and substitution of tools .
Python It's completely free to use and distribute . Just like other open source software , for example ,Tcl、Perl、Linux and Apache. You can start your Internet Free access Python Source code . You can copy without restriction Python, Or embed it in your system or release it with the product . actually , If you like , You can even sell its source code .
But please don't get me wrong :“ free ” Doesn't mean “ No support ”. On the contrary ,Python Our online community is as responsive to user needs as commercial software . and , because Python Completely open source , Improve the strength of developers , And produced a large team of experts .
Although studying or changing the implementation of a programming language is not so interesting for everyone , But when you know you can do this if you need to , How gratifying . You don't need to rely on the wisdom of business vendors , Because the final document and the ultimate pure land ( Source code ) Let your use .
Python Development is community driven , yes Internet The result of a wide range of collaborative efforts .Python Language changes must follow a set of normative and binding procedures ( Referred to as PEP technological process ), And it needs to be thoroughly checked by the standardized test system . That's what makes Python It can be conservatively and continuously improved compared with other languages and systems .
Even though Python 2.X and Python 3.X The split between versions has effectively and deliberately undermined this tradition , But usually it is still reflected in Python Inside these two series .
Python The standard implementation of is made up of portable ANSI C Compiling , It can be compiled and run on all current mainstream platforms . for example , Now from the palm computer (PDA) To supercomputers , Can be seen everywhere Python Operation of .Python Can run on the following platforms ( Here is just a partial list ):
In addition to the language interpreter itself ,Python The self-contained standard libraries and modules at the time of release also consider cross platform portability as much as possible in their implementation . Besides ,Python The program is automatically compiled into portable bytecode , These bytecodes are installed in compatible versions Python The results are the same when running on the platform of .
These mean Python The core language and standard library of the program can be found in Linux、Windows And others with Python The interpreter runs indiscriminately on the platform . majority Python Peripheral interfaces have platform related extensions ( for example COM Support Windows), But the core language and libraries are the same on any platform .
As we mentioned before ,Python It also contains a called tkinter(Tkinter Of 2.X edition ) Of Tk GUI tool kit , It can make Python The program realizes complete functions , It can be used in all mainstream without any modification GUI Graphical user interface for desktop platform operation .
From the perspective of language characteristics ,Python It's a mixture . Its rich toolset puts it somewhere between the traditional scripting language ( Such as Tcl、Scheme and Perl) And system language ( Such as C、C++ and Java) Between .Python Provides the simplicity and ease of use of all scripting languages , And it has advanced software engineering tools that can only be found in compiled languages .
Unlike other scripting languages , This combination makes Python It is very useful in long-term large-scale development projects . Here are some Python Introduction to the tools in the toolbox :
In addition to this series Python Outside the tool ,Python It maintains a fairly concise syntax and design . The result of all this is a powerful programming tool with all the usability of scripting language .
Python Programs can easily interact with components written in other languages in a variety of ways “ Bonding ” together . for example ,Python Of C Language API Can help Python The program flexibly calls C Program . This means that you can give as much as you need Python Program add function , Or in other environmental systems Python.
for example , take Python And C perhaps C++ The library files are mixed together , send Python Become a front-end language and customization tool . As we mentioned before , This makes Python Become a good rapid prototyping tool ; The system can be used at the initial stage of development for speed Python Realization , Then transfer to C, Gradually realize the system according to the performance needs in different periods .
Same as other languages ( Such as C++、Java and C#) comparison ,Python Programming is surprisingly simple for most users . To run Python Program , You simply type Python Just program and run it . No other language is required ( Such as C or C++) Necessary intermediate steps such as compilation and linking .
Python The program can be executed immediately , This creates an interactive programming experience and the ability to quickly adjust in different situations , Often you can see the effect of the program change almost immediately after modifying the code .
Of course , The short development cycle is just Python One aspect of ease of use .Python Provides simple syntax and powerful built-in tools . actually ,Python Used to be called “ Executable pseudocode ”. Because it reduces the complexity common to other tools , When implementing the same function ,Python Programs are simpler than programs written in other popular languages 、 small , And more flexible .
Last , You may already know , People tend to Python And Perl、Tcl and Javat And other languages . This part summarizes some general consensus in this regard .
I want to make it clear in advance that I personally don't like to win by slandering competitors —— This will not work in the long run , And it's not the purpose here . Besides , This is not a zero sum game —— Most programmers use many languages throughout their careers . For all that , Programming tools also show choices and tradeoffs worth considering . After all , If Python Nothing offers more than its competitors , Then it won't be used in the first place .
We've covered the performance tradeoffs before , Here, we will focus on the functions . Although the languages listed below are also powerful tools worth learning and using , But people usually think that Python:
Especially for text files that are not only used for personal scanning , The future will be ( Including you ) Read the program , A lot of people will find out Python Better value than any currently available scripting or programming language . More Than This , Unless your application requires cutting-edge performance ,Python Tend to be C、C++ and Java And other system development languages :Python Code can often achieve the same goal , But it will reduce a lot of writing 、 The trouble of debugging and maintenance .