Over a million developers have joined DZone.

Why Python? What's it Good For? How is it Special?

DZone's Guide to

Why Python? What's it Good For? How is it Special?

Learn not only what separates Python from other languages, but also what tried-and-true reasoning keeps it around as a powerful coding force.

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

First. The question is moot. It's a programming language. It's good for programming.

When I push back, folks try to produce languages which exist only in certain pigeonholes. "You know, PHP is for web and JavaScript runs in the browser. What's Python for?"

The PHP and JavaScript examples aren't helpful. That doesn't narrow the domain of problems for which Python is appropriate. It only shows that some languages have narrow domains. 

 "Objective-C and Swift are for iOS. What's the predominant place Python is used?" 

Python also runs on iOS. I don't know if it has suitable bindings for building apps. If it does, that doesn't change my answer. It's good for programming. 

"Java is used mainly for web apps, right? What about Python?"

Okay, at this point, the question has slipped from moot to ignorant. Can we just set that aside? Can we move on? If you want some useful insight, start here.

Yes, it's an essay from 1974. Parts of it are a little old-fashioned, but a lot of it is still rock-solid. For example, the idea of strongly typed pointers is considered more-or-less standard now. It was debatable then. And Wirth's opinion continues to drive language design.

Page 28 has the key points: features of a programming language. Enumerated by the inventor of Pascal, Modula, Oberon, and other languages too numerous to recall. Sure, some of the list is a little dated. "Different character sets," for example, have been superseded by Unicode. Also, the list is focused on compiled languages. Python is a dynamic language. It's interpreted. Yes, there's a compiler, but that's mostly an optimization of the source code. If you replace "compiler" with "run-time," the list stands up as a description of good languages.

I like this list because it helps characterize why Python works out so well, and why many other languages are also pretty good. It points out the reason why quirky languages like JavaScript (or even Ruby) are suspicious. Some of the points about efficiency are important topics for further discussion.

I often have to remind folks who work with Big Data that most of our processing is I/O bound. Python waits for the database somewhat more efficiently than Java. Why does Python wait more efficiently? Because it uses less memory. Sometimes this is a win.

Let's not ask silly questions about a general-purpose language. Instead, let's benchmark solutions, and compare tangible performance numbers using real code.

Related Refcard:

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

bindings ,python

Published at DZone with permission of Steven Lott, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}