Python is (Not) a Scripting Language
I find myself questioning when someone calls Python a scripting language


Published on by nick

Tags: bash, python, scripting, programming-language

I'm reading Kief Morris' book, Infrastructure as Code, and early on he refers to Python, lumped together with Bash, Perl, PowerShell and Ruby, as a general-purpose scripting language. While many developers (including myself) use Python to script things, I would conclude that, in general, Python is not a scripting language.

Some years ago, a colleague recommended an all-purpose tool for doing utility scripting. At the time, I was mostly working on Windows, so batch was an obvious choice. And similarly, since many of our servers were running some flavor of Linux, bash scripting was good too. At that time, I decided to learn bash, because I knew I was going to be working primarily in the Linux/Unix environment moving forward.

The way in which I use bash follows a common theme: I find myself needing to automate some task, and often it needs to run on a Linux system. This "script" should also be callable without human intervention, eg, started by another program or script. I might need to transfer data between servers; I might need to parse a test file and output to another file; I might need to automate system administration tasks. So what do I do? I open vim and start typing commands. It's so easy, and it's so intuitive, that it fits right in. I'm already performing many of these tasks manually in the terminal, so why not just collect them into a file for use later on...

Now obviously I can perform some if not all of these tasks with Python. For that matter, I could use Perl, Ruby, or several others for these kind of simple utility scripts. But I don't, because it's so quick and easy to use something like bash. But this is not why I believe Python is not a scripting language. It actually can be considered a scripting language, depending on how you define one. There are numerous articles and Stack Overflow discussions that deep-dive into this topic, so I will not go into much detail here. Suffice it to say, if the script/program is interpreted it's often considered a scripting language; if it's compiled, it's not. OK, that's a clean distinction right? Wrong... It seems there is debate even on this definition.

The thing about Python is that it "sit[s] in both camps: Python is widely used without a compilation step, but the main implementation (CPython) does that by compiling to bytecode on-the-fly and then running the bytecode in a VM, and it can write that bytecode out to files (.pyc, .pyo) for use without recompiling. (T.J. Crowder, 2013)"

My definition is more about how you use the tool, rather than how it's interpreted or compiled. If you use it to do utility tasks or all-purpose chores, it's a scripting language. If you use it to write high-level, powerful applications, it's not. I mean, take JavaScript for example: it has "script" right there in the name, and certainly it's very easy to use for "web scripting" -- but then again, you can write highly scalable web applications with JavaScript that handle millions of connections and process loads of data.

The more I learn about Python, the more I realize that this programming language is capable of quite a lot. Take, YouTube, Dropbox, and Pinterest for example. These large-scale web applications rely on Python for key pieces of their stack, and they handle large amounts of traffic and data.

Python is also a favorite among the scientific and cybersecurity communities. Michael Kennedy (@mkennedy) over at the Talk Python to Me podcast, described as "[a] podcast on Python and related technologies" has guest after guest on who discuss how Python is basically revolutionizing the technology world with its pervasiveness and power. It's used so widely and for so much, that calling it merely a scripting language is no longer accurate. Sure, it can be used to script tasks and automate anything, but it's also so much more. It has been called a scripting language quite a lot, but I think it's time to stop doing so... Just because lots of people do something, doesn't mean it's the right thing to do.

Take bash, on the other hand... it can only really ever be used to script tasks -- sure, it can be used to write more complex programs; but, by and large, developers and technologists who use it, use it for its ease of use, it's ubiquity, it's fusion and integration with the most widely used operating system in the server and application world: Linux.

My goal in writing this article is not to start an argument. It's mainly to make a distinction that I believe is becoming more apparent. I think that part of the reason Python is still referred to as a scripting language by some folks is that it had this stigma associated with it for many years. But when frameworks like Django came around, and then the distributed nature of large-scale web applications began taking the world by storm, Python stepped up and filled a very important niche -- simple, easy-to-use, yet powerful and widely supported, not to mention the enormous community of open source projects on GitHub, and the nearly 100000 packages available through PyPi...

Comments

Comments powered by Disqus

 Blog Search

  Popular Tags

django, ubuntu, mod_wsgi, apache, authentication, python, tls, linux, forms, ssl, virtualenv, dell, uwsgi, bash, nginx, raid, customer-service, centurylink, ux, software-companies, rais, form, centos, password, certificates, tinymce, mdadm, dual-boot, file-server, virtualhost, gluster, IT, blog, get, networking, piplight, distributed-file-system, big companies, bitnami, cygwin, windows, samba, scripting, pygments, post, programming-language, ui, lampstack, outsourcing, isp, security, usabillity, provision, php, shared-hosting, netflix, git, flatpages, syntax-highlighting, virtualbox, hg, redirect, usability, prg, acls, change-password, complex, view tags...

 Questions/Comments?

Drop me a line... [email protected]
Follow me on Twitter... @nicorellius
Share on Facebook...