Yet for all its popularity, Python is often misperceived as slow, clumsy and limited to small projects. The reality is, Python is a powerful and flexible language. It enables development teams to rapidly develop robust, elegant solutions to tough problems. In this article, I’ll bust four myths about Python and explain why it’s so valuable.
Myth 1: “Python is just a scripting language.”
A scripting language operates atop an existing software system to extend its functionality. However, the term is more often used as a sneaky pejorative to imply limits on a language’s usefulness. The speaker often wants to frighten others into using the “real” language they prefer instead.
While Python excels in the role of a literal scripting language, it is by no means limited to this functionality. We can compare it to the Java programming language, long a staple of serious software engineering. Both languages sport the ability to interface with the network and operating system; for this reason, Python is a mainstay in server and network automation. Extensive standard libraries and development ecosystems enable both to excel in almost any practice area. Python is very much Java’s functional equal in all regards.
Myth 2: “Python is slow.”
Because Python is an interpreted language, there is some truth to this. There are many implementations of the Python language and most are slower than languages like Go and Rust. For this reason, some developers are hesitant to use it for performance-critical projects, such as API backends and big data pipelines, yet Python actually excels at both!
Not all Python interpreters have the same performance. One of these, PyPy, implements a just-in-time compilation strategy similar to the Java JVM and thus achieves Java-like performance.
Python also supports binary extensions, which allow communication with compiled C code, typically to handle CPU-intensive operations. Libraries like numpy, Modin and Pillow use them to boost performance. Python can even interface with code from other languages via the CFFI binary extension. A few tools can even compile parts of your Python code to machine code in advance.
Finally, the default Python interpreter, CPython, is undergoing significant improvement. Python 3.11 is showing performance improvements between 10-60% over 3.10 and even higher compared to Python 3.9 and earlier. The notion of CPython being sluggish is starting to become a thing of the past.
Myth 3: “Python is single-threaded.”
A single Python process cannot use more than one CPU core, because of the language’s Global Interpreter Lock (GIL), which actually improves interpreter performance. Nonetheless, Python is fully capable of parallelism and concurrency, which are crucial tools for creating responsive user experiences and performing complex computations.
Asynchrony and traditional threading make concurrency possible in Python. Parallelization is achieved through multiprocessing and extended via libraries like Ray, Dask and JobLib, all of which bypass the GIL. Binary extensions can also be used to parallelize expensive operations.
If anything, the delineation between parallelism and concurrency gives developers more control over when and how to use each.
Myth 4: “Python is weakly typed”
Static typing, specifying the data types for variables, is familiar for many developers. For them, Python’s dynamic typing system can feel a bit like working without a safety net at first. Once you’re used to it, however, it is one of Python’s greatest strengths.
Should I Use Python?
Selecting a language for a project is not a simple process. It helps to consider both the technical needs of the project and the existing team’s skills and knowledge. Python isn’t necessarily the answer to all your problems, any more than Java is, but it certainly bears consideration. Anything you can do in Java or another programming language, you can do in Python, and usually with significantly simpler code. Testing, style and code quality are easily implemented, thanks to tools and standards oriented around evolving best practices. All this saves significant development time, both up front and in maintenance.
About the Author
Jason C. McDonald is a Principal Consultant at Sparq. As a Python expert, he’s a speaker and the author of “Dead Simple Python” (No Starch Press). When he’s not coding, he’s usually writing fiction books, playing piano, or spending time with his mother and two dogs.
Five Ways User Feedback Can Transform Your Product Strategy
User feedback is a critical asset that can provide valuable insights into your users' wants and needs. It can also give important observations into your application's overall performance. In this article, Principal Product Strategist Toyia Smith shares five ways to better incorporate user feedback into your product strategy.
Balancing Technical Debt and New Features: A Product Owner’s Guide
The term "technical debt" frequently emerges in discussions about software development, product health and organizational effectiveness. However, its true meaning and the balance organizations must find between managing this debt and new feature innovation can be confusing. In this article, learn how to manage that delicate balance so you can create an exceptional product.
Navigating Digital Product Discovery: A Guide to Avoiding the 5 Common Pitfalls in Custom Product Development
In digital product development, a well-structured discovery phase is critical to a product’s long-term success. However, bringing a digital product from concept to reality can be challenging. In this article, Principal Product Strategist Josh Campbell shares his guide to avoiding five common pitfalls during digital product discovery.
Preparing Your Business for the Realities of AI and Machine Learning: Beyond the Hype
The buzz around artificial intelligence (AI) and machine learning (ML) has almost certainly reached a fever pitch. With benefits including increased efficiency and enhanced customer experiences, many businesses are eager to take advantage of these technologies. In this article by Chief Technology Officer Derek Perry, learn why organizations need a solid foundation to ensure they're ready to harness the benefits of AI and ML, before jumping in headfirst.