#!/usr/local/bin/python3 from threading import local class C(object): a = 1 l = local() def __init__(self): if not hasattr(self.l, 'h'): self.l.d = {} C().l.d[1] = 1 C() print(C.l.__dict__)