In this post we create a *DiskCacher* class that can be used as a *with* context manager, a function wrapper and as the pie-syntax decorator. It modifies a given computation function, and tries to use the cached data if possible, and only do the re-computation if the cache is not found or the user forces an overwrite.
On top of netcdf4, there are some more advanced packages in Python that could make the manipulation of NetCDF data, and your life a lot easier.
In this post I'll talk about some basic 2D geographical plotting workflows, using the `matplotlib` and `basemap` packages. Then we cover some common issues that are worth your attention when creating such plots.
Mixins are like "plugins" to classes, they can be used to extend the functionality of a class in a more modular manner.
We use memoization to cache the computed results to help speed up the computation of Fibonacci numbers, and lazy evaluation to create a generator that outputs new Fibonacci numbers indefinitely.
`pdb` is the built-in debugger of Python. With the **REPL** (Read-Evaluate-Print-Loop) Python interpretor, the `pdb` debugger can be extremely helpful in the initial development, and of cause, the debugging stages of your project.
This category is not intended to be a comprehensive tutorial to Python, but a collection of tips, helpful code snippets and some Python projects that I think might be worth sharing.