I am currently working with the geopy package under Python 3.5. I use the geopy.Point package. I included it in very many files and never had issues. Unfortunately I now have trouble debugging since the Point __str__
function uses a geodetic datum system as output by default.
I would prefer to see only latitude and longitude if possible. I do not know why geopy is using this geodetic system, so it might be that I just don't get the advantage of it. But as far as I can see this system is not very helpful debuging.
So now I seek a way to change the __str__
function in a very elegant way. What is the most pythonic way to do this? Just writing an wrapper messes with code completion as far as I can tell.
Here an example to explain what I mean:
from geopy.point import * #import the package
def str_p(point): #a function to get the format I actually can read
return "Lat= "+str(point.latitude)+" | "+"Long= "+str(point.longitude) #always writing .latitude or .longitude when debugging is troublesome
p = Point(55, 17) #create a Point, note that we are using Lat, Lng
print(p) # 55 0m 0s N, 17 0m 0s E , a good format if you are manning a pirate ship. But confusing to me
print(str_p(p))# what I want