Skip to content

Instantly share code, notes, and snippets.

jamescasbon /
Created December 11, 2011 16:37
Pure python templates using with statement
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
This module defines a template language that allows us to do:
d = Doc()
bnyeggen /
Created July 16, 2011 14:17
Example showing how to use instance methods with the multiprocessing module
from multiprocessing import Pool
from functools import partial
def _pickle_method(method):
func_name = method.im_func.__name__
obj = method.im_self
cls = method.im_class
if func_name.startswith('__') and not func_name.endswith('__'): #deal with mangled names
cls_name = cls.__name__.lstrip('_')
func_name = '_' + cls_name + func_name