Learning Python


I have used Matlab for several years and have been pretty happy with the features it supplied.  The only problem is the price tag for those features.  Within my university, there is already a growing number of people using or considering Mathematica.  Looking at the prices, I can understand why.  That said, its still expensive.  Also, I’m not a great fan of the language, but perhaps that’s just because I haven’t used it yet.  Then there’s Python, a general purpose language with lots of free packages and lots of development going on.  Since I’ve decided to leave Matlab, primarily because of the price, why not take the leap to a totally free language instead, so I’ve committed to moving to Python.

One of the main things I want to use this blog for is to share the things I learn about Python and the packages on offer.  That’s the purpose behind my Learning Python blog posts.  Code that I present in those posts (or am planning to blog about) is available in my Bitbucket repository.  All of these posts can be found under the ‘Learning Python‘ category.  I’m also going to collect links to useful packages and online resources that taught me something memorable.

Useful packages

  1. argparse: Parses command line arguments and supports all the features I’ve needed thus far.  It supports several complex concepts such as groups of mutually exclusive arguments and arguments with a discrete set of valid values, to name a few.
  2. Numba: A just-in-time compiler that uses decorators to specify which of your functions should be compiled to target either your CPU or, since version 0.13.0, your CUDA-capable GPU.  I have a few posts on how I’ve used Numba to accelerate code.
  3. IPython notebooks: The notebook is a web-based interactive interface to Python.  Apart from the good looks, I also really like the ability to edit an earlier cell in the notebook to correct a bug, run that cell to update the data it provides and then continue with the code at the end of the notebook.  This makes debugging much faster as it cuts out what could be a lot of code in between that doesn’t need to be rerun.

If you are looking for pre-compiled binary installers for Microsoft Windows for any packages then http://www.lfd.uci.edu/~gohlke/pythonlibs/ is a good place to start looking.

Useful links

  1. @SciPyTip: Useful tips and links about Python packages used in scientific computing highlighting useful functions, package updates, etc.
  2. SciPy lecture notes – Advanced Numpy: This is a very practical document explaining, among other things, how to use strides in Numpy arrays to change the mapping from array indices to physical memory locations.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s