Defaultdict
Create a dictionary of items which has a default value:
from collections import defaultdict
cache = defaultdict(lambda: [])
defaultdict
takes in a function, in here we use lambda
to create an anonymous function that always return an empty list.
as a result:
cache["someKey"] # returns []