程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python is so perfect, but why dont opponents give up vilifying it?

編輯:Python

Software development has long been a minefield .

Ordinary people will find , Using traditional programming languages ( Such as C and JAVA) Breaking into the software world is terrible .

But once Python Join the game , This situation soon changed .Python With its revolutionary programming method, it is a great leap in software development .

People love Python, Because of its simplicity 、 Extensive library support and presentation capabilities . therefore , image C and Java The rule of such language is over .

Nothing is perfect . wait , Really? ?

If you're a software developer , You may be familiar with ** Balance (trade-off)** The word .

Every time a question about programming language pops up , People usually get a traditional answer :“ As the case may be ”.

It is generally accepted that there is no perfect programming language . wait , Is it true that ?

For me, , Not so . In my submission Python Is the silver bullet in the programming language .

up to now , I used Python、C、C++、MATLAB、JAVA.Python It's the last thing I've touched , But it's the best .

In order to test Python, I did an experiment , And put most non Python The program is converted to Python. The final Python The version is much better .

at present , as far as I am concerned ,Python Has been severely criticized on two issues :

  • Dynamic type
  • Speed

Although I agree that these problems have a significant impact on software development to some extent , But I can confirm , Most of these are Python Problems in the early days of birth .

However , Thanks a lot rock-solid Community ,Python It has evolved to be equivalent to almost every programming language . Dynamic type and speed no longer have a significant impact on coding practice .

Python Can be used to deal with any problem .

If so , Why? Python It hasn't been adopted on a large scale yet ?

therefore , It is necessary to explain why dynamic typing and performance problems are small problems that are easy to ignore .

Dynamic type

To understand dynamic types , It's best to understand the opposite first —— Static type .

Statically typed languages have C、JAVA etc. . The main difference between these languages and their dynamically typed counterparts is type checking . Static types are type checked at compile time , Dynamic typing is type checking at run time .

notes : This is a bland definition of dynamic and static types . The specific technical details are beyond the scope of this paper .

because Python Debugging problems , as well as Python How language makes tracking bug The process has become more complex than it is now , Some developers are right Python Complain a lot .

This complaint stems from the fact that : As a dynamically typed language ,Python Mark errors at run time , This makes it more than Java Statically typed languages such as are more error prone .

Theoretically , This is a threat , After all, considering a famous proverb —— People make mistakes . But in practice , I doubt if the typo is as serious as they claim .

No kidding , Who still makes type mistakes now ?

Statically typed languages are far from an accessible debugging haven . Except for the wrong type , Most statically typed languages cannot catch subtle errors that you might think should be detected . These errors also occur in static and dynamic types .

Besides , Almost no code is deployed without unit testing . Unit testing is a good defense against type errors . Only in rare cases , Type errors can bypass unit tests to mess up code . In terms of commissioning , Another feature of programming languages is safe and unsafe types . Languages that allow users to override system types are considered unsafe types —— for example C. Although unsafe types give users control over types , But its misuse will cause the program to crash arbitrarily .

Most statically typed languages are unsafe type systems . However ,JAVA Is a safe type language .Python And other dynamically typed programming languages I know .

Last , I prefer to use things like Python Write code a million times in such a convenient and high-level language , Instead of falling into JAVA In the low-level details of language .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved