Skip to content

Instantly share code, notes, and snippets.

@davidallsopp
davidallsopp / typed_eq.py
Last active December 29, 2015 10:19
A slightly typesafe (!) comparison function in Python. Only a runtime check of course, but will fail fast with a clear exception rather than silently comparing different types than can never be equal. I'm sure this is wildly unpythonic, but given that I've seen bugs from this kind of comparison even in statically typed languages like Java and Sc…
def eq(first, *rest):
for r in rest:
assert type(first) is type(r), "Different types %s, %s for inputs (%s,%s)" % (type(first), type(r), first, r)
if first != r:
return False
return True
# eq(1) - True
# eq(1, 1) - True
# eq(1, 1, 1) - True
# Install PostgreSQL and PostGIS Via Homebrew
# One click installer seems to fail to get PostGIS installed.
# Download GISGraphy Binaries from http://www.gisgraphy.com/download/
# Move unzipped directory into /src/gisgraphy
# INITIALIZE TABLES
psql -U postgres -d gisgraphy -h 127.0.0.1 -f /src/gisgraphy/sql/create_tables.sql