In Python, what is the more efficient way of using types as dictionary keys? Given a classObject, should I use classObject.__name__ or the object itself directly?
In Python, what is the more efficient way of using types as dictionary keys?
Share
Since type names don’t have to be unique across modules, you must use the type (
classObject) itself.Luckily, types will automatically have a non-trivial hash value: