class Location(Vector): def __init__(self, x, y): super().__init__(x, y) lat, lon = latitude, longitude = Vector.Element(0), Vector.Element(1) def __lshift__(self, other): return geopy.distance.vincenty((other.lat, other.lon), (self.lat, self.lon)).km def __rshift__(self, other): return geopy.distance.vincenty((self.lat, self.lon), (other.lat, other.lon)).km def __repr__(self): return '[{lat:.05f}, {lon:.05f}]'.format(lat=float(self.lat), lon=float(self.lon)) @property def list(self): return [self.lat, self.lon] @property def string(self): return '{}, {}'.format(self.lat, self.lon) @property def copy(self): return Location(self.lat, self.lon) @staticmethod def fromString(string, reverse=False): return Location( *list(map(str.strip, string.strip('[]').split(',')))[::-1 if reverse else 1])