Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import collections
- def default_factory():
- return 'default value'
- d = collections.defaultdict(default_factory, foo='bar')
- print 'd:', d
- print 'foo =>', d['foo']
- print 'bar =>', d['bar']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement