I wish to have a dictionary which contains a set of state transitions. I presumed that I could do this using states = defaultdict(None), but it's not working as I expected. For example: states = defaultdict(None) if new_state_1 != states["State 1"]: dispatch_transition() I would have thought that states["State 1"] would return the value None and that if new_state is a bool that I would have gotten False for new_state != states["State 1"], but instead I get a KeyError. What am I doing wrongly? Continue reading...