Wednesday, December 5, 2012

What is Python good for?

Another student asked on the Udacity CS101 forum about what Python is good for. If you'd like to see the original question, see: http://forums.udacity.com/questions/2006694/trying-to-find-out-more-about-python#cs101

Here was my reply to that question:

The major limitation of Python traditionally is performance, but you can generally dodge that by coding the really hot loops of your program in compiled C routines that you invoke from Python. The great advantage of Python is that you'll have working code while the guy working in C++ or whatever is still debugging.

There are some notable Python features that the course didn't delve into: Python user-defined classes and modules - and a few data types: imaginary numbers, decimal numbers, rational numbers. The language has pleasant surprises in its lack of limitations.

It's really not that huge of a language so there's not all that much more for you to know to know the language, but behind the language there's a gi-normous collection of library routines for you to draw upon. Google is your friend for discovering what is out there, but whatever your field of endeavor, it is worthwhile to check to see what library code is out there to help you along. There are routines to help you write data parsers, routines to help you write AI programs, routines to help with math and the list goes on.

There's a style to pulling Python code together that you need to get used to if you want to consider yourself to be a Python expert. The gotcha is that Python will accept code that is garbage and not tell you about the junk being junk until you drive your program into trying to run the junk, so Python gets along well with test-driven-development. You need to develop test cases to drive the program though as much of the possible execution paths as you can. There are Python library modules to facilitate that approach to the code. Getting facile with test-driven-development is still on my to-do list, but I'm now taking CS258 from udacity.com in hopes it will at least give me a sound appreciation of the limitations of the approach.

Moving further away from problems I understand and into problems I'm only aware are out there to grab me and thrash me about: I've heard that Python has problems with making use of n processors at once and that there's reason to believe that the future is in multi-core systems where n processors is going to feature bigger and bigger n as time goes by. There are at least theoretical reasons to believe that Haskell or perhaps Erlang are going to fit more comfortably into that world of the future.

If, like me, you enjoy learning new stuff, there's no reason to worry about running out of new stuff to learn! Yay for computer science!

Drew