The program that I write processes a large number of objects, each with its own unique identifier, which itself is a string of complex structure (a dozen unique fields of an object connected by some kind of separator) and a long length.
Since I have to quickly process many of these objects, and I need to re-access them by id during processing, and I donβt have the ability to change their format (I extract them from the outside, over the network), I want to display their complex string id to to my own internal identifier of an integer and then use it for comparison, for further transferring them to other processes, etc.
What I'm going to do is use a simple dict with keys as the string identifier of the object and integer values ββas my internal integer identifier.
My question is: is there a better way in Python to do this? Maybe there is a way to calculate some hash manually, independently? Maybe dictating is not the best solution?
As for numbers: in the system there are approximately 100K of such unique objects at a time, so the integer capacity is more than enough.
izhak source share