Created
August 7, 2014 17:57
-
-
Save lucemia/2587d8106cc64da58bd4 to your computer and use it in GitHub Desktop.
defaultdict with key
This file contains hidden or 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 vdict(defaultdict): | |
| def __missing__(self, key): | |
| return self.default_factory(key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment