I want to implement a symbol type, which keeps track of the symbols we already have(saved in _sym_table
), and return them if they exist, or create new ones othe
Seems to me you want the Symbol instances to be singletons. Deepcopy, however is supposed to be used when you want an exact copy of an instance, i.e. a different instance that is equal to the original.
So the usage here kinda contradicts the purpose of deepcopy. If you want to make it work anyhow, you can define the __deepcopy__ method on Symbol.