Using signal.alarm() for a timeout
The Python signal module let’s you setup Unix signals, including SIGALRM.
Read more →Reliable file updates in Python
Machines can fail, so it’s important to make sure your files are saved. This article has some great ways of doing reliable file updates with python. Great stuff.
Read more →Stubbing out open() in Python
Here’s an example that stubs out the open() function in Python using the mock library.
Read more →Cool Python
Check out the example in the 3rd comment : http://code.activestate.com/recipes/413137-call-a-functionmethod-x-times-per-second/ That is cool.
Read more →The enter method in the with statement
The with statement is a great addition to Python. One thing that might not be immediately clear from the documentation is how the __enter__ method has to be implemented. If you want to use the object containing __enter__ then you have to return self there. You should not create a new object and return it.
Read more →