My girlfriend has always wanted to program. She even took C++ in high school and college, but never quite “Got it”, leaving her with a bad taste for computers and programming. Still, when I lent her my copy of The Little Schemer, she took to it pretty easily, so I knew she had the potential to be able to program, despite her past difficulties.
So then the question becomes what language to teach her. While Scheme would be a nice choice in theory, despite more than three decades as a teaching language, it’s still not popular in the mainstream. While this wouldn’t be important in a classroom setting, adults have a different set of needs for programming. Notably, they need to be able to apply their skills quickly to something in their life.
That’s why Python fits the bill so well. First off, its simple. It’s syntax is absolutely minimalist, as are its features. I call Python by “80% Language”, in that 80% of all tasks I need to do, I can do with Python. It doesn’t have Ruby Blocks, or Interfaces, or Lisp Macros, Python is arguably the best general purpose language out there.
The key to Python’s success is three part. The first of those is design. Python’s roots as a teaching or prototyping language meant that there is an emphasis on simplicity and elegance. It’s very light on syntax, it supports Object Oriented programming, but does not demand it, and operations that are performed often, like array indexing, hash table lookups and mapping have special syntax to make them more convenient.
Python also stays firmly in the general purpose language camp. R has become increasingly popular for statistics work in the last five years, and while R does have extensions, it is designed for data analysis. Perl started off its life as a text processing and scripting language, and while it’s grown out of that role, it still has those concepts embeddeded within it. Python changes slowly over time and borrows from other languages while staying true to itself. For example, Python recently adopted Asyncronous IO in the core, but does not require that any program use it.
The second strength Python has are its libraries. While Python has fewer libraries than Perl, it offers more simple, practical interfaces to more systems. For example, I mentioned R earlier, and Python programmers can interface directly with R through RPy, while still being able to use simple web accessing frameworks like Requests, and powerful phonetic algorithms such as those found in Fuzzy. In fact, whole Python distributions have been created around nothing but packaging up the best libraries for a particular task, such as SciPy, and Biopython.
The third, and perhaps most important strength of Python is its user community. I’m sure this will be the most controversial part of this post, but I’ve found the Python community has bar-none the most supportive users. This is not by accident, but part of Python’s legacy and current commitment to inclusion. Python came from a teaching language background, and documentation was, and continues to be part of that legacy. Python is used as a teaching language in High Schools as well as MIT.
In addition, the Python Foundation focuses a lot of attention and energy into community diversity through its Diversity Statement, as well as commitment to bring women into the community, both through their own local communities (PyLadies) but also focusing on bringing that diversity into mainline events such as PyCon. The net effect is that Python is not only welcoming to women, but has a general welcoming atmosphere to people of virtually any background.
If someone is considering Python, especially if they have a scientific background, I suggest watching Science and Python, and jumping in with Learn Python the Hard Way followed with New Coder, which is described in depth at this talk by Lynn Root.