Created
April 18, 2013 07:45
-
-
Save yhchan/5410941 to your computer and use it in GitHub Desktop.
python defaultdict
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
class _MissingDictionary(defaultdict): | |
def __missing__(self, key): | |
return defaultdict(_MissingDictionary) | |
configs = defaultdict(_MissingDictionary) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment