I have a number of objects that I need to associate with an integer. These objects are ArcGIS Point objects (exactly what they do not matter) that store the X and Y values ββfor the point as floating point numbers.
I need to write this, for example:
Point(X = 2.765, Y = 3.982) -> 2 Point(X = 33.9, Y = 98.45) -> 7 Point(X = 1.23, Y = 2.43) -> 9 Point(X = 8.342, Y = 6.754) -> 5
Then I need to be able to search for the resulting value by the values ββof X and Y. I tried to use Point objects as a dictionary key, but this does not work, because when I recreate a point object from the values ββof X and Y, it no longer looks right (presumably because the identifier of the object has changed).
How do I relate these point values ββto integers. Is there any other way to use a dictionary?
python dictionary floating-point hash
robintw
source share