Modern Python versions (3.6+) have a memory performance optimization for dictionaries, where dict keys are shared between various class instances.I am asking if plain Python's dictionaries have the same optimization?Given the two dicts with shared keys:
d1 = {"name": "Havoc", "hand": "left"}
d2 = {"name": "Malice", "hand": "right"}Are "name" and "hand" shared between these two or does each one have a separate key inside Python's memory pool?EDIT:No, the keys of normal dictionaries are not shared. As outlined in the PEP 412, only internal dictionaries of class instances share their keys: for OOP in Python, I guess.