Staging
v0.5.1
https://github.com/python/cpython
Revision c48b055258cfc31d8043af9c427e7a0e2980e60d authored by Benjamin Peterson on 06 March 2010, 20:37:32 UTC, committed by Benjamin Peterson on 06 March 2010, 20:37:32 UTC
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78739 | benjamin.peterson | 2010-03-06 14:34:24 -0600 (Sat, 06 Mar 2010) | 10 lines

  Merged revisions 78718 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78718 | gregory.p.smith | 2010-03-06 01:35:19 -0600 (Sat, 06 Mar 2010) | 3 lines

    Call setreuid and setregid in a subprocess to avoid altering the test runner's
    process state.  Should fix issue8045.
  ........
................
1 parent e4b56d2
Raw File
Tip revision: c48b055258cfc31d8043af9c427e7a0e2980e60d authored by Benjamin Peterson on 06 March 2010, 20:37:32 UTC
Merged revisions 78739 via svnmerge from
Tip revision: c48b055
antigravity.py

import webbrowser
import hashlib

webbrowser.open("http://xkcd.com/353/")

def geohash(latitude, longitude, datedow):
    '''Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    '''
    # http://xkcd.com/426/
    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:]))
back to top