開源日報 每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,堅持閱讀《開源日報》,保持每日學習的好習慣。
今日推薦開源項目:《眾所周知……? 0.30000000000000004》
今日推薦英文原文:《Python』s Advantages and Disadvantages Summarized》

今日推薦開源項目:《眾所周知……? 0.30000000000000004》傳送門:GitHub鏈接
推薦理由:眾所周知,1+2=3,10+20=30,那麼理所當然的:0.1+0.2=0.3。這當然是正確的,但是計算機興許不那麼想,如果試一下,很容易就會發現 0.3 後面多了點奇奇怪怪的東西……這就是浮點數運算不精確的命運啊(嘆息)。這個項目列舉了很多會造成這種迷之算錯的例子,興許在使用浮點數時應當小心謹慎。

今日推薦英文原文:《Python』s Advantages and Disadvantages Summarized》作者:Jun Wu
原文鏈接:https://medium.com/better-programming/pythons-advantages-and-disadvantages-summarized-212b5fdf8883
推薦理由:對於 Python 的優缺點總結

Python』s Advantages and Disadvantages Summarized

Are you a Python programmer? What are your thoughts?

Python』s been gaining popularity year over the year for the past few years. In a 2019 Stack Overflow survey, Python was named the second-most beloved language of developers.

Python』s often cited as being multipurpose and easy to be productive in. Its domination in machine learning and data science is well-known.

In recent years, Python』s web-development frameworks — such as Django and Flask — are gaining popularity. For many developers, Python』s living up to its hype as it』s selected for more of a variety of projects in various organizations. For new developers, Python is increasingly becoming the first language to learn to enter the job market.

But for all of its hype, developers who』ve worked with Python for some time have noticed some limitations.

This article is a summary of some of the observations about Python from the development community without injecting my own experiences. Popular discussion threads in Quora, Stack Overflow, and various blog posts are the references for this article. For a complete list of references, see the end.

Advantages of Python

There are many advantages of Python. I』ve only listed the top few.

Python is multipurpose

You』ll find Python being used for front end, back end, data science, machine learning, web development, and mobile-app development. It』s one of the most multipurpose languages around. The fact it can be used for so many programming paradigms, from object-oriented to functional, makes it very versatile.

Python』s also often named as a great scripting language for people who don』t develop software but need to use scripts to retrieve information.

Python is used by many in education to teach programming basics

Python is increasingly used at the university level to teach programming basics to students.

This is mainly due to its ease of use and ease of learning. There』s a lower barrier to entry for new programmers to learn Python. This has also allowed many self-taught developers to transition into development roles.

Python has a huge, supportive community

One of the most cited advantages of Python is its inclusive community of programmers.

At the entry level, you can often find answers to your questions very easily in Python developer forums. There are various expert blogs online that are dedicated to spreading knowledge about Python — not only to learn it but to master it.

Python』s also open source, which allows it to continuously improve with the help of long-time community members.

Python』s dominance in data science and machine learning

With the integration of data science and machine learning into today』s systems, Python』s robust, mature libraries — such as scikit-learn, keras, pandas, etc. — are unmatched. These libraries allow engineers who work with data to be productive much more quickly.

Python』s a language of choice for prototyping

The simplicity of the Python language makes it a perfect choice to use for prototyping.

Often, when the prototyping is done with a lot of productivity and little effort, it』s then easier to select Python for developing the actual product.

Python code is simple, readable, and can be more maintainable

Python』s easy-to-use explicit syntax allows code to be more readable.

If used correctly, codebases for Python can be more maintainable than those done in other languages.

Python』s ability to integrate into other enterprise applications

Python』s extensible. You can write part of your project in Python and part of it in C++ or C. This is why many use it to plug into enterprise applications. You can also embed Python into the code of other programming languages.

Python』s matured

In the last few years, Python has matured into a language that』s chosen for large projects by Google, Yahoo, YoutTube, Dropbox, etc. — not to mention by nontechnology companies in finance, healthcare, education, etc.

Disadvantages of Python

Python has several disadvantages that developers often cite.

Python』s memory consumption and garbage collection

Python』s memory usage is high. Memory consumption has to be carefully tracked throughout a project. It』s often essential to follow best coding practices to sidestep potential memory issues.

Python uses reference counting in its garbage collection, which can be misunderstood.

Python』s dynamically typed

Many in data science and machine learning prefer statically typed languages.

Type error is the one thing you don』t want to be worried about when working with a lot of data. Using a statically typed language can potentially reduce a lot of bugs in the system.

Multithreading in Python is not really multithreading

Due to the global interpreter lock (GIL), Python』s multithreading model doesn』t truly have threads running at the same time. One thread can only hold the GIL at one time, which means you』re not achieving true multithreading.

Many use a different implementation of Python — such as IronPython, Jython, PyPy, or a C extension — to achieve true multithreading.

Python in functional programming

Python』s functional programming can be difficult to read, which defeats the purpose of using a language like Python that』s known to be simple and easy to read. Functional optimisations aren』t supported by the compiler. It also lacks some features of functional programming that need to be implemented manually.

Conclusion

With many obvious advantages over disadvantages, we』ll likely see Python grow further in the years to come.

Where will the usage of Python be headed is anyone』s guess.

Data science and machine learning are where Python has the potential to dominate. But in these areas, where large amounts of data will need to be processed often using functional programming, the disadvantages of using Python, such as speed, dynamic typing, multithreading, memory consumption, etc., will become more prominent.
下載開源日報APP:https://openingsource.org/2579/
加入我們:https://openingsource.org/about/join/
關注我們:https://openingsource.org/about/love/