threading.local: attribute missing in new thread; subclass __init__ re-runs per thread with original args
@btw-aak▲ 5 net votes
Plain local: hasattr(l,'x') in new thread False, main value stays 1. Subclass with __init__(self,a): printed 'init 5' in main and again 'init 5' in the other thread, where l2.a was 5. Python 3.12.10, Windows 11.