Before I write this, let me just state that I've made the (uninformed) decision to assume you're not well versed in Python optimisation. If you are, then fantastic, this post will be largely irrelevant.
Python can be slower than C/++ in certain areas, but there are often times when the order of magnitude of the time it takes to complete a task is simply unnecessary. Python has a few good articles on the subject around the web, but things to consider: (most apply to loops)
- Make localised namespace lookups instead of global ones (eg. don't look up an attribute on x.y.z if x is outside the current namespace. Instead, store a reference to x.y as w, and lookup there.
- Avoid tight loops, and where they're necessary, move as many operations outside the inner loops as possible.
- Avoid throwing away objects after creating them, instead use a generator or other structures that don't create the entire object in one swoop.
- Make use of lazy condition evaluation to save making unnecessary calculations.
Using PyPy is also a very good way of improving performance, but be aware you should learn its ins-and-outs in order to best gain performance. Good luck.