Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| /* | |
| * credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield) | |
| * for the original concept which was part of their RoamGames submission | |
| * and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/ | |
| * | |
| */ | |
| /* ======= OPTIONS ======== */ | |
| /* note: if you change these, reload the page to see the effect */ |
| # -*- coding: utf-8 -*- | |
| ###################################################### | |
| ## (c) 2012-2013 MDG Web limited - MIT licence | |
| ###################################################### | |
| import cPickle | |
| class RedisCache(object): | |
| """Redis cache""" | |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!