Home/Blog/Why learn Python? 5 advantages and disadvantages

Why learn Python? 5 advantages and disadvantages

11 min read
Erica Vartanian
editor-page-cover

Python was first released in 1991. Over 30 years later, Python remains one of the most popular programming languages among hobbyist and professional developers worldwide. TIOBE declared Python the programming language of the year in 2021. This was the third time Python won these honors in the last five years alone.

The Python programming language is highly developed, both culturally and technically. Python developers often call themselves Pythonistas. The Python language even has its own philosophy: the Zen of Python. With versatile use cases across various industries, Python developers are in high demand. So, should you join the ranks of Python developers and become a Pythonista yourself?

Today, we hope to help you make a confident decision on whether you should learn Python. We’ll cover five advantages and disadvantages of learning Python, and why you might choose to learn it.

We’ll cover:

Get hands-on with Python today.

Try one of our 300+ courses and learning paths: Python for Programmers.


5 advantages of Python

1. Large developer community

Python is one of the most popular programming languages in the world. In Stack Overflow’s 2021 Developer Survey, 48% of respondents said they work with Python. When other respondents were asked which technology they had a desire to learn, Python ranked first as the most wanted technology among developers.

Data from Stack Overflow's 2021 Developer Survey

Python’s large open-source community means Pythonistas can enjoy strong peer support and helpful documentation. If you ever run into a roadblock, you can always check out Python forums or meetups to get help from other Python developers. This community support can be especially helpful if Python is your first programming language.

2. Extensive libraries

Python offers a wide range of libraries that can be used across various applications. Libraries are collections of resources that help us streamline application development. Instead of writing every piece of code from scratch, we can use libraries, which contain many pre-written functions and classes.

Some popular Python libraries include:

  • Numpy and SciPy: For scientific computing, with a wide range of functions, algorithms, and optimizations, including linear algebra and statistics
  • Keras, Seaborn, TensorFlow, and SciKit-Learn: For machine learning, artificial intelligence, natural language processing, and neural networks
  • Scrapy: For data science, allows you to make an effective web crawler and data scraper
  • Pandas: For data analysis, including data cleaning and manipulating both relational and labeled data
  • Matplotlib and Plotly: For data visualization and plotting graphs

3. Write less, do more

Python has very concise syntax. This is noticeably true even when compared to other high-level programming languages, such as Java.

By comparing the “Hello World” program in Python to Java, we can see that Python’s syntax is much more concise.

print "Hello World"
"Hello World" in Python
class HelloWorld {
public static void main( String args[] ) {
System.out.println( "Hello World!" );
}
}
"Hello World" in Java

Python’s simple syntax, combined with its large set of libraries, help us do more with less lines of code. This saves a lot of development time, and is one of the reasons for Python’s popularity.

4. Portability

Portability is another one of Python’s strengths. Portability refers to an application’s ability to run across various operating systems (OS). Unless your program contains system-specific calls, you can run your Python program across Windows, Mac OS, and Linux without modifying the program code. All you have to do is to use the Python interpreter that’s appropriate for your chosen platform.

Python’s portability is largely attributed to its use of an interpreter instead of a compiler. Both interpreters and compilers convert source code into machine code. However, they do so at different times, and in different ways. Interpreters convert source code during program runtime, while compilers convert it before program runtime. Specifically, Python’s source code is converted into an intermediate form called bytecode, which can be executed on any platform that has a Python interpreter. In contrast, a compiler would convert source code into non-portable machine code which could only be executed on a specific platform.

Languages that use an interpreter are known as interpreted languages. Interpreted languages are generally more portable than compiled languages, which use a compiler.

5. Wide range of use cases

The Python programming language has various use cases in many growing fields, including:

Get hands-on with Python today.

Try one of our 300+ courses and learning paths: Python for Programmers.


5 disadvantages of Python

While these may not be deal breakers for you, it’s good to be aware of Python’s disadvantages before you commit to learning a language.

1. Slow performance

Python is slow in performance when compared to other high-level programming languages. Python takes a hit for performance as a tradeoff for features that have their own merits.

A few factors that affect Python’s performance are:

  • Use of an interpreter: The interpreter translates code during runtime instead of before runtime (like the compiler). The additional overhead from runtime translation results in slower code execution for interpreted languages than compiled languages.
  • Use of dynamic typing: Python is dynamically typed as opposed to statically typed. Dynamic typing allows us to create variables without declaring types. Rather, the type of variable is decided at runtime. This means that our program is doing a few more tasks at runtime, which affects our performance.
  • Use of garbage collector: Python supports automatic memory management rather than manual memory management. This means that instead of us having to manually allocate and deallocate memory, the work is done automatically for us by the garbage collector, which demands memory at runtime and affects the rest of our application’s performance.
  • Python’s object model: Python’s object model doesn’t lend toward efficient memory access. Rather, it consumes a lot of memory. We can observe an example of this in the following figure below.

The previous figure compares a batch operation on a Python list with a C++ array. In a C++ array, we can have objects of the same type and sizes. For these objects, a contiguous memory is reserved, where each object can be accessed in a “constant time” using its respective index. In contrast, a Python list can contain objects of different types and sizes. A list is basically an array of pointers, where each pointer points to the memory address where its corresponding object is stored. These pointers to objects result in an additional overhead that is not present in other languages.

Python isn’t designed as a memory efficient language. As such, it’s not the best choice of programming language if you’re building an application in a resource-constrained system. For the same reason, you’d likely want to choose another language if you’re building highly performant applications such as real-time, highly concurrent systems.

2. Distinct nomenclature

Python has a distinct nomenclature that prioritizes simple syntax. The fact that Python’s nomenclature is simple isn’t a disadvantage. However, it’s worth noting that Python’s nomenclature deviates from norms that other programming languages may agree on.

Some examples of Python’s distinct nomenclature include:

  • Differences in terminology: The data type we refer to as a dictionary in Python is otherwise known as a hash in Java and C++.
  • Differences in punctuation: We use single quotation marks (‘) to close strings in Python, as compared to double quotation marks (“) in most programming languages.

Python’s unique traits aren’t easily transferable to other programming languages. Whether you learn Python before or after you’ve learned other languages, expect to encounter some unique qualities that are specific to Python.

3. Code can become unruly in size

When it’s small in size, Python code is easy to understand. However, Python doesn’t enforce many coding standards. This means Python code can quickly become too large if we aren’t carefully following coding best practices. If we let it reach this point, a large code base is more difficult to understand and extend.

Python’s syntax can make large code even more difficult to read. For example, the code can become misleading if we don’t do proper commenting for dynamically typed variables. To add, deeply nested code in Python can also be difficult to understand because the scope of variables isn’t easily apparent. Furthermore, nested code can be difficult to read because Python uses spaces instead of brackets or other scope identifiers (such as we do in C and Java).

4. Global Interpreter Lock (GIL) and threading limitations

CPython, Python’s most popular implementation, uses a Global Interpreter Lock (GIL). GIL is a mechanism that has benefits and drawbacks. GIL is used by an interpreter to limit the threads that can be executed per process. Specifically, the GIL only permits one thread to be executed at a given time.

GIL is used because memory management isn’t thread-safe in CPython. By permitting only one thread at a time, GIL prevents any unintended interactions between data structures in a Python program. However, this means that multithreaded CPython programs aren’t able to make the most of multiprocessor systems by doing parallel processing.

Python’s GIL and threading limitations will affect you if you use Python’s most popular implementation, CPython. As such, you might stay away from GIL if you plan on implementing multithreading and concurrency in your program. Other interpretations of Python, such as IronPython and RPython don’t use GIL.

5. Weak support for mobile development

Despite its various use cases, Python is a weak contender for mobile development. Of the main mobile platforms, neither Android nor iOS support Python as an official language. It’s still possible to develop mobile applications with Python without native platform support. However, we’d require some frameworks or libraries to help make this happen.

That being said, there remains a lack of mature frameworks or libraries to support Python mobile development. Some technologies exist (such as the Kivy framework). However, as they’re less developed, they may come with a steeper learning curve and little community support. There’s also a lack of Python user interface (UI) libraries, which makes it difficult to achieve a good user experience in Python mobile apps.


Why learn Python?

You’ve heard the good and the bad. So, why learn Python? Of course, your final decision will depend on your goals as a developer.

When deciding whether to learn Python, you might consider the following factors and whether they align with your goals:

  • Fun community: Python’s community is built around the intention to make the language fun to use. In fact, its name isn’t a reference to the serpent, but rather, to the British comedy group Monty Python.
  • Career opportunities: Learning Python can help you get a developer job you love. Python developers are in demand in both big companies (such as Netflix) and smaller organizations and startups.
  • Industry use cases: Python has applications across various industries. The language is particularly a strong choice if you’re interested in areas such as machine learning, data science, game development, and back-end web development.
  • Learning curve: Python has very human-like syntax compared to other programming languages. This can make the learning curve quite easy for beginners. As previously mentioned though, you may initially experience the opposite effect if you’re used to other programming languages.
  • Flexibility of a multi-paradigm language: Python supports multiple programming paradigms. You can use Python for functional programming, object-oriented programming, and procedural programming.
  • Resources and tools: Because it’s so widely used, there’s an abundance of resources you can leverage to learn Python. There’s also a wide selection of tools, frameworks, libraries, and Python IDEs to help streamline your development.

Wrapping up and next steps

Despite its shortcomings, there are various reasons why Python remains popular over thirty years after its release. Of course, your reason for learning Python will be unique to you. Whatever your motivation, you’ll soon find you’re in great company with a thriving worldwide community of developers who share one common language: Python.

To help you master the Python programming language, we’ve created the Python for Programmers course. This course covers the fundamentals of Python, from data structures and algorithms to object-oriented programming. It also contains tutorials and materials covering more advanced topics such as web scraping and creating web APIs.

If you’re completely new to programming, you might want to check out Learn Python 3 from Scratch. This course assumes no prior programming experience and covers the basics of Python from the ground up.

Happy learning!

Continue learning about Python


WRITTEN BYErica Vartanian

Join a community of more than 1.4 million readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.