Initialized merge tracking via "svnmerge" with revisions "1-73579" from
[python/dscho.git] / Lib / antigravity.py
blob7670187f83af0cf13039643c3f55e2f2ae15b6bf
2 import webbrowser
3 import hashlib
5 webbrowser.open("http://xkcd.com/353/")
7 def geohash(latitude, longitude, datedow):
8 '''Compute geohash() using the Munroe algorithm.
10 >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
11 37.857713 -122.544543
13 '''
14 # http://xkcd.com/426/
15 h = hashlib.md5(datedow).hexdigest()
16 p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
17 print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))