When I went to college, I learned C,C++,Java, Later, at the beginning of my work, I used Java Development , Later, I changed my career Python Development . Think Python It's a language that you don't regret , And getting started is relatively easy . When I first changed careers, I started my project after reading grammar and framework for a week because I had the foundation of other languages . Readers often ask me what language I would like to learn when I change my career , I will not hesitate to recommend Python, Because he is really strong . about Python There are many friends in language. There have been some misunderstandings , I sorted out my own views and some information on the Internet , Friends can refer to ha !
Not today xx Is the best language , Because programmers are very real Of . There is no result in discussing such a topic , Borrow Microsoft Dmitry Kakurin Saying “ This is a matter of faith . therefore , Any reasoning and argument will be endless , And it makes no sense ……”, Existence is reason , It's hard to say which is better or worse in different application scenarios . Programming languages don't have to be too serious , Just choose one that can solve your own problems . Of course, as a programmer, you can't just focus on one language , If you don't improve yourself , Then the development space is basically determined .
In recent years Python Into the vision of more and more people , The forum also reveals from time to time Python exceed xx Language .Pyton Language as AI Session of the ‘ online celebrity ’, Some time ago I was asked to Python Join the news screen of the college entrance examination ,2017 year 2 month Python Also officially moved to the world's largest same-sex dating platform (GitHub) On . If you are on the Internet , Must be able to personally feel Python The popularity of the language .Python Language is easy to learn because of its simplicity 、 The grammar is beautiful 、 A wide range of applications and many other advantages , Captured a large number of fans .
The following figure is the data I got from Baidu Index
stay 2014 Years ago Python The search index is very low ,14 After years, the search index has increased greatly ,17 In, he even surpassed big brother Java. Many people think that Python It is a language that has only appeared in recent years , Actually Python stay 1989 In .
1989 Christmas of ,Monty Python"s Flying Circus Off the air .Guido I'm going to find something else to spend my Christmas holiday , So he invented python Language .-- Maybe this is the big guy
until 1991 It was officially released in , Compared to Java It's still early .Python Cultivate yourself silently , It's a big thing . Can be so many Coder love , Nature has its unique charm .
python The father of -Guido van Rossum
Python Follow Java Very similar , Both are open source 、 Object-oriented languages and are all cross platform .Java Cross platform is dependent on JVM(Java virtual machine ) and Python The cross platform of is determined by its own language characteristics .Python Are called scripting languages or glue languages , Really leading in scripting , But we can't ignore that it is now an independent programming language , In fact, it also has a very rich development framework 、 Third party Library , It is no less functional or flexible than other languages .
except web In development, we have Django、Flask、Sanic、Tornado And so on .Python It is also used in academic research and scientific fields , because Python It has a powerful library and simple syntax , Even non computer professionals can get started quickly . In terms of data analysis ,Python Yes Matplotlib and numPy Such a powerful drawing library and scientific computing library , This makes Python It is difficult to replace in this field . besides Python It is also used in machine learning 、 natural language processing 、 big data 、 Cloud computing 、 Reptiles 、 neuroscience 、 psychology 、 Electronics manufacturing 、 The image processing 、AI Technology and other aspects have strong class libraries and frameworks . So that there was “ No language can shake Python In the future, the core language of production and life ” That's what I'm saying .
Talk about Python Concurrent , Then you can't avoid GIL(Global Interpreter Lock). Actually GIL Not at all Python Characteristics of , It is to achieve Python Parser (CPython) A concept introduced , The official explanation is :
In CPython, the global interpreter lock, or GIL, is a mutex that prevents multiple native threads from executing Python bytecodes at once. This lock is necessary mainly because CPython’s memory management is not thread-safe. (However, since the GIL exists, other features have grown to depend on the guarantees that it enforces.)
To put it bluntly GIL Is a global lock , This will have a great impact on multi-threaded context switching , You could even say Python It's a single threaded program . There are a lot of questions Python The lack of concurrency is also excusable , however Python There are also many concurrency packages and frameworks .
Global interpreter lock GIL Is in Python Performance optimization in most use cases , It's also CPython Code usability optimization in development .GIL It can make it easier for operating system threads or green threads to use , At the same time, it does not affect the use of multiple processes .
At present, a large number of server-side software adopt Python Development , We also see Python The server has millions of requests per machine every day , But they can be easily handled . So it can't be said Python Lack and release support .
and Python The development team released the Python Repair points of the four routes
1、 To shorten the Python Start time of
2、 Speed up Python Named tuple of
3、 restructure CPython Internal API
4、 Get rid of Python Medium GIL Burden
The rise of Douban is Python Instance witness of the feature , Its founder spent only three months using Python Built the initial Douban community framework . Douban was founded in 2005 year , At that time Python It's really popular , Why not choose the relatively mainstream Java perhaps PHP Well . Because if you didn't choose Python You have to deal with a lot of work yourself , It is impossible for a person to complete a fully functional website in a short time , therefore Python It becomes the only choice , Douban is not the only major website in China 、 For example, Zhihu 、 NetEase 、 Baidu 、 Ali 、 potatoes 、 Sina and so on use Python Language development
Instagram Registered users reached 30 Billion , Monthly active users exceed 8 Billion ( As a contrast , Wechat monthly active users are 9.38 Billion ), Hundreds of millions of clicks a day . Behind such a huge amount of data, it is known for its slowness Python+Django. today , Even if you already have more than 30 Million registered users .Instagram Still Python and Django Heavy users of .Instagram The engineer Hui Ding Speaking of : 『 Until the user ID Already exceeded 32bit int The limit of ( about 20 Billion ),Django Itself has not yet become our bottleneck .』
What is a big project ? To put it bluntly, now we think that the big projects will develop with the development of technology and Coder Ability 、 The improvement of vision , Looking back, it may be a small project . To put it bluntly , As long as people are strong, nothing is a problem . just as erlang As the author of , Whether the maintenance is simple or not mainly depends on whether you can quickly locate the code you want to modify . It has nothing to do with language , As long as the clear structure is ensured .
Python There are real shortcomings :
You should also know that in programming languages , The fastest is C,Python Everyone knows that the running speed is slow . In fact, this is not the case ,Python Slow operation , But the amount of code is very small . Dozens of lines of code can do it C A few hundred lines to do .
The reason is ,C Is a compiled language and Python It's an explanatory language , Compilation language and interpretation language , It's totally different in essence : The compiled language can finally correspond directly to the machine code .C/C++ Is a typical compiler language .
Language is just a factor , Evaluate the speed and slowness of a language individually , Sometimes it's not appropriate . Should be applied to an application , It is best to evaluate against a specific use case . For example, use Java,Python Also implement a software evaluation . because Python You can talk to C、C++ Good mutual calls , Where performance is really needed, you can use C、C++ Expand , Then, where coding efficiency needs to be improved, use Python Realization , The overall software written in this way may be better than Java fast . But in fact Python Put developer efficiency first from the beginning of design .
Python Programmers are scarce
Python It is popular late in China , Undeniable? Python Quantity ratio of development Java、PHP Of Coder Much less . Including some second and third tier cities Python There are only a few development posts , This may be due to the linkage between industry demand and education , But current educational trends suggest that this is likely to change . According to recruitment website data , On average, every month Python Demand for recruits 12331 people , In the golden nine silver ten recruitment season, the demand was once as high as 20600 people . Since I choose to be an Internet person , No matter what language you are working on , No matter what language you choose to learn . Believe in your own judgment , Programmers use many languages throughout their lives && technology . Spend more time investing in yourself , Is never wrong !
Python Extensive use scenarios , Many start-ups are the first choice in technology selection Python As a development language , Although most companies fail , But it also gave birth to Python The sight of a fire in the country ,Python Development efficiency is very high , But the running speed is criticized by many programmers Python The main reason is . In recent years PyPy The continuous improvement of the interpreter ,Python In some scenarios, the running speed is approaching C, So the future speed may not be a problem at all .
In recent years, Python The number of Development Engineer posts has soared . The salary of the employees is fairly good , So there must be a large number of beginners , It is also inevitable that the average salary will be lowered . There are risks in the business , Be careful when you enter the business . We don't want to be language experts , Instead, try to become an expert in the field , You can change your language when it's down , Without a solid foundation , I'm afraid it will be eliminated along with the language . To practice martial arts, you should practice moves , You should also practice your internal skills , Don't take programming languages too seriously , Just choose the right language to solve your problems .
There is Tao without skill , Art can be sought , No way with skill , Stop at surgery