Hashing in python
Vish
vahuja4 at gmail.com
Sat Feb 13 18:44:37 EST 2010
More information about the Python-list mailing list
Sat Feb 13 18:44:37 EST 2010
- Previous message (by thread): Py3: Terminal or browser output?
- Next message (by thread): Hashing in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I need to hash 3d coordinates to a grid which has been divided into
4*4*4 squares. Using python, I thought of a simple way as follows:
CELL_SIZE = 4
def key(point):
return (
int((floor(point[0]/CELL_SIZE))*CELL_SIZE),
int((floor(point[1]/CELL_SIZE))*CELL_SIZE),
int((floor(point[2]/CELL_SIZE))*CELL_SIZE)
)
Since python allows keys to be tuples, I think that this should work.
Is there a better (more efficient) way to do it?
Thank you,
Vishal
- Previous message (by thread): Py3: Terminal or browser output?
- Next message (by thread): Hashing in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list