Geohashing

R

Raymond Hettinger

import hashlib

def geohash(latitude, longitude, datedow):
'''Compute geohash() in http://xkcd.com/426/
37.857713 -122.544543

'''
h = hashlib.md5(datedow).hexdigest()
p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h
[16:32])]
print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))

if __name__ == '__main__':
import doctest
doctest.testmod()
 
N

norseman

Marco said:
The byte type is new in 2.6
================================
As I've said before:

"It is far more simple to police ourselves.
The posting needs (its creation) ... DATE. ... The code needs to state
OS and program and version used to write it. And from there - user beware."

Which would reduce the confusion greatly. I got the same error message
and decided it was from an incompatible version, using incompatible
modules. Looks as if I guessed right. I pity the poor first timer.

Steve
 
M

Marco Mariani

norseman said:
The posting needs (its creation) ... DATE. ... The code needs to state
OS and program and version used to write it. And from there - user
beware."

Which would reduce the confusion greatly. I got the same error message
and decided it was from an incompatible version, using incompatible
modules. Looks as if I guessed right. I pity the poor first timer.

Raymond is living in a parallel universe (Fahrenheit 3K) where all the
previous Python releases have been burned ;)


dystopianl-ly yours,
 
N

norseman

Marco said:
Raymond is living in a parallel universe (Fahrenheit 3K) where all the
previous Python releases have been burned ;)


dystopianl-ly yours,
============================================

AH! That explains it. :)

He must have worked at Apple in it's earlier days. Those were the days
that when a new OS version came out you basically picked up your current
computer and threw the whole thing in the trash. Once the new OS
version was installed ALL third party purchased programs and probably
all those you had written stop functioning. Maybe your data could be
salvaged, maybe not. To make matters worse, the new upgraded program
probably failed to accomplish the one thing you bought the original to
accomplish. Not to mention the price tag was now more.

Maintaining upward compatibility was what gave Gates the edge. With
Gates' OS a small company did not need a 100 geeks to be constantly
rewriting the envelope addressing program. He (or whoever he hired)
could build the tool and then he could proceed to making a better living
by letting the computer do the same-o same-o time killers while he
serviced the customers. For most it is all about the coin of the realm.
For a few it is about the extra leisure time. What ever your goal it's
a cinch you hate to be constantly paying to remake things that already
worked perfectly.

Gates trouble began when he started playing the Apple game.
Apple is on the rise because it took the lesson from Gates.

Several of my teachers along the way noted: "Evolve or Perish."
I agree with that. Thing is, they all had a problem with the one
question I asked each:
"When the evolution proceeds to the point the latest one born is no
longer compatible with the existing, how is it gonna make babies?"


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,292
Messages
2,571,494
Members
48,171
Latest member
EllaHolmwo

Latest Threads

Top