I need to find the distance between two places (p1 and p2). For this, I have created a function which works great, this is find_dist. In this function, it matches the specific places in ElasticSearch and returns the distance between those. Only, the outcome for both places, when switched, needs to be the same. So p1,p2 = p2,p1.
The distance output looks like a matrix:
dist = {(p1,p2):find_dist(p1,p2) for p1, p2 in product(zipcodes, zipcodes) if p1!=p2}
How can I adjust the code (or add a line) to make sure that p2,p1 = p1,p2?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…