from collections import defaultdict
d_int = defaultdict(int)
d_list = defaultdict(list)
def foo():
return 'default value'
d_foo = defaultdict(foo)
>>> d_int
defaultdict(<type 'int'>, {})
>>> d_list
defaultdict(<type 'list'>, {})
>>> d_foo
defaultdict(<function foo at 0x7f34a0a69578>, {})