Advanced Design Patterns in Python

If you have been using python for a few years, I suggest looking over the following tutorial:

The tutorial covers some of the basics of comprehensions, generators, decorators, context managers, descriptors, and meta classes. If you don’t know what any of these things are, the tutorial will at least give you a basic idea of their definitions. Comprehensions, generators, and decorators should be useful for every-day astronomy programming. The tutorial illustrates how decorators can be particularly useful for timing bits of your code. Decorators have also been used in the very nice PyMC package for applying Markov Chain Monte Carlo methods. The later topics are most useful when you are starting to do more complex object-oriented programming.

In the comments below, I am interested in hearing about how you have used some of these advanced design patterns in your astronomy programming.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *