开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
今日推荐开源项目:《众所周知……? 0.30000000000000004》
今日推荐英文原文:《Python’s Advantages and Disadvantages Summarized》
开源日报第633期:《众所周知……? 0.30000000000000004》
今日推荐开源项目:《众所周知……? 0.30000000000000004》传送门:GitHub链接
推荐理由:众所周知,1+2=3,10+20=30,那么理所当然的:0.1+0.2=0.3。这当然是正确的,但是计算机兴许不那么想,如果试一下,很容易就会发现 0.3 后面多了点奇奇怪怪的东西……这就是浮点数运算不精确的命运啊(叹息)。这个项目列举了很多会造成这种迷之算错的例子,兴许在使用浮点数时应当小心谨慎。
开源日报第633期:《众所周知……? 0.30000000000000004》
今日推荐英文原文:《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/