Learning Python - Day 3

Learning Python - Day 3

Python Pros and Cons

Pros and Cons: In this article, we will take a look at various pros and cons of the Python programming language as a new learner to the language. We will know about its comprehensive standard library, the advantages of Python being community?driven, the great third?party support you will find for Python development, as well as diving into some of the cons that come along with the Python programming language.

Pro: Comprehensive Standard Library: When learning a new programming language, one question we need to ask ourselves is what functionality it provides in its included standard library. If you think of Python as everything you can use out of the box, you can think of a standard library as a collection of code that you can immediately use to do different things, like creating a user interface, making web service calls, parsing files or many other things. There are two different philosophies towards providing a standard library. One philosophy is to provide a very small and minimal standard library with the language. A goal of this philosophy is to allow the language and libraries to evolve separately. It also enables applications built with the language to only pay for the size and complexity of the features it uses instead of a bunch of code that the application will never call. The downside is that you may have to pull in a fair amount of not included code when building a nontrivial application. The other philosophy is to provide a comprehensive standard library. When learning a new programming language, a comprehensive standard library provides a lot of room to experiment with the language with various projects. You can do this without needing to resort to using various third?party libraries, which helps minimize the amount of learning you need to do to build your projects. Some languages may also try to strike a balance between these two philosophies. Python's Standard Library, of course, includes much of the basic functionality that many different types of applications are going to need. You can find common data structures, like collections, like lists, sets, and dictionaries, or file I/O that lets you read and write files. You can work with dates and times, you can do data compression and archiving, or you might use more domain?specific features like building user interfaces, working with CSV or XML files or audio data. And this is all just the tip of the iceberg. Python provides great documentation for its Standard Library as well where you can go learn more if you're interested. With the size and quality of Python's Standard Library, you can write a large number of different programs before you ever need to expand your skills out into third?party libraries and tools.

Pro: Community-driven: Starting with the release of Python 2.0 on October 16, 2000, Python's development process was changed to become more transparent and community?backed through the use of Python Enhancement Proposals, or PEPs. The PEP process is the primary mechanism for proposing major new features, for collecting community input on an issue, and for documenting the design decisions made for various features. Outstanding PEPs are reviewed and commented upon by the Python community and by Guido Van Rossum, Python's creator. This has enabled Python to evolve as a shared language and evolved to users' changing needs over the years. The benefits of this approach can be seen as early as PEP 20, often referred to as the Zen of Python. This PEP helped form a common foundation of various Python principles and philosophies that would help formulate the shape of Python for years to come. We've already discussed some of these principles in this course, but there are several more. The Zen of Python is a great read if you're interested in learning more about the North Star guiding Python design today. Another benefit of the PEP process is the transparency that comes with each new Python release. If you click the What's new area of a Python release, you will be taken to the release notes for that Python version. These release notes include links to all the individual Python Enhancement Proposals for all new features and enhancements in the release. If you then dig into a single proposal, you can read the proposal itself, including overviews of the feature, the specification for the feature, and even objections and concerns about the feature. This provides very transparent insight into each successive Python release, and it emphasizes the strength that comes from having a community?driven development process as a programming language. Python's community also has many different ways it uses to connect. You can connect with other Python users on everything from mailing lists to IRC to forums to special interest groups and local user groups or newsletters. There's also the Python Software Foundation, a nonprofit organization dedicated to promoting open source technology related to Python. The Python Software Foundation actively supports the community through providing infrastructure the community relies on, produces PyCon, the largest annual gathering of the Python community, and they also give out grants every year to help support Python causes

Pro: 3rd Party Libraries: Now, there's already a lot you can do with Python out of the box as we've discussed, but an added benefit of Python being community?driven and embracing community?written software is that there's a lot of very useful code out there available to you. If you're interested in creating something, no matter the field you're in, there is probably a library out there already that can help you out. One of the first things we may want to do is discover what third?party libraries other people have written that we can use. How might we go about discovering this? In the Python world, there's the Python Package Index, or PyPI, where people often publish their Python code to so it can be used by others. There's a lot of projects and users that have built up this large collection of Python code that we can dip our toes into. People from all around the world are publishing their projects and libraries into the Python Package Index. Working with PyPI is incredibly simple too. All we need to do is use a tool called pip. Pip comes installed by default with many Python distributions and installs. Installing packages with pip is incredibly straightforward. It's as simple as executing pip install, followed by the package you want to install. Then that package is ready to be used in your project. Pip provides us several areas of functionality to work with for us using the code of others. Yes, we can install and uninstall Python packages, after all, that's the main purpose for a Python package manager in the first place. But is there anything else? Well, yes, there is. Pip helps us by not only letting us track our own dependencies, but also by installing and uninstalling the dependencies of the packages we're installing into our project. We can track a group of Python packages as a package group. This allows us to install, uninstall, and otherwise manage the package group as a single unit, and pip can also help us make sure we're using the right versions of third?party libraries. This helps prevent us from breaking our software by unknowingly trying to use a different version of a package than we support. We discussed in previous videos how Python is used in many different fields and for many different reasons. This also becomes evident in the wide variety and maturity of popular third?party libraries that there are to use for Python. It doesn't matter whether you're doing data science, web development, imaging manipulation or developing different types of applications, there are third?party libraries out there that have you covered.

Pro: 3rd Party Tools: Another area we see the benefit of Python's community and growing popularity is in the area of third?party tooling. Python has many different tools that you can leverage in all stages of development. First of all, there are many IDEs and editors to choose from when writing Python code. There's PyDev, an Eclipse?based Python IDE, there's PyCharm, a great Python IDE from JetBrains, Visual Studio Code also supports Python development. There are even domain?specific IDEs like Spyder, the scientific Python development environment. Spyder is designed by and for scientists, engineers, and data analysts. This is especially useful if you're using libraries like NumPy, Matplotlib or others. If you want a more lightweight experience without the overhead of a full?blown integrated development environment, many text editors also have great support for Python. You can get good Python support in Sublime, Vim, Emacs, and many others. It's not just IDEs and editors that you can benefit from either. There are even more great third?party Python tools available to you. You have tools like Flake8 that provide support to enforce style guidelines in your projects, code analysis tools like Pylint, and code formatters like project Black. If you're working on a team of developers, Black can help you avoid any debates about how code is formatted by automatically formatting code the same way for all developers. We've also seen major software vendors providing performance analysis support for Python in their major products, like Intel's VTune suite. As you can see, Python is not just a programming language for hobbyists or noncoders. Its third?party ecosystem has helped continue to turn it into a powerhouse programming language that can be used for major software projects.

Drawbacks: Lest do you believe that Python is the perfect programming language out there no matter what problem you're working on, there are some downsides to using Python that you might want to be aware of. We will discuss three of the largest drawbacks to Python in this video. I hope that knowing about these drawbacks will help you make a more informed decision on your possible usage of Python. The first Python drawback is that it's interpreted. This has the negative consequence that it's often quite slow, especially compared to native languages like C, C++ or Go. There are workarounds as there are some compilers that exist that will compile your Python code to native code, but they're not supported directly out of the box. The next drawback of Python is that it's not native. Unfortunately, this is contributed to it having high?memory usage in several cases, and it also lacks a native security sandbox. These limitations have led to Python not being widely adopted directly in the web browser or on mobile platforms. So while Python continues to see large usage on the server, its usage on desktop and mobile lags behind. Lastly, Python is a dynamic language. While this carries some advantages with it, it also has downsides. One big downside is that with the absence of a compiler, errors primarily occur at runtime where they can be more difficult for developers to diagnose. This lack of error diagnosis at the point of developers writing code can make it more difficult to refactor code and ensure proper working code as code evolves and improvements are made. For many workloads, the pros outweigh the cons, but if you're needing to build native experiences or write high?performance code, Python may not be the best choice for you.

要查看或添加评论,请登录

???????????? ?????????? ?? ??的更多文章

  • Learning Python - Day 6 - Exceptions

    Learning Python - Day 6 - Exceptions

    In most programs, there is a clear notion of the normal path through the code. But, of course, conditions can arise…

  • Learning Python - Day 5

    Learning Python - Day 5

    Objects and Types Overview While you can get a long way in Python with fairly shallow understanding of its underlying…

  • Learning Python - Day 4

    Learning Python - Day 4

    Installing and Starting Python Overview In this module, we'll cover obtaining and installing Python on your system for…

  • Learning Python - Day 2

    Learning Python - Day 2

    What is python? Unique Syntax: Python syntax is unique when compared to other programming languages. Many programming…

  • Learning Python - Day 1

    Learning Python - Day 1

    Hi Friends, This article is kind of like a notes that I'm taking while brushing up my python coding skills. What I'm…

  • The Healthy Approach To Productivity

    The Healthy Approach To Productivity

    Today we are discussing about healthy approach to productivity based on the book "Only Study Guide You'll Ever Need" by…

  • Blockchain Technology, Part - 06

    Blockchain Technology, Part - 06

    What is Bitcoin? Let's meet first blockchain in the world. Bitcoin Bitcoin is a decentralized digital currency that got…

  • Blockchain Technology, Part - 05

    Blockchain Technology, Part - 05

    Blockchain Architecture Transaction Flow - Traditional systems In order to understand the working of a blockchain…

  • Blockchain Technology, Part - 04

    Blockchain Technology, Part - 04

    Ingredients for a Blockchain Hash: Fingerprint for Data You might have come across the term 'hash', maybe as root hash…

  • Blockchain Technology, Part - 03

    Blockchain Technology, Part - 03

    A Basic Dictionary of Blockchain In the previous article, we had a brief note on decentralized networks, distributed…

社区洞察

其他会员也浏览了