Popular Python recipes tagged "distance"http://code.activestate.com/recipes/langs/python/tags/distance/2013-01-17T20:50:21-08:00ActiveState Code RecipesHamming Neighbors (Python) 2013-01-17T20:50:21-08:00Yong Shinhttp://code.activestate.com/recipes/users/4184933/http://code.activestate.com/recipes/578423-hamming-neighbors/ <p style="color: grey"> Python recipe 578423 by <a href="/recipes/users/4184933/">Yong Shin</a> (<a href="/recipes/tags/distance/">distance</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/hamming/">hamming</a>, <a href="/recipes/tags/programming/">programming</a>). </p> <p>HammingNeighbors returns all integers that are k number of bits away (i.e. k Hamming distance away) from an integer. <br /> The algorithm uses dynamic programming.</p> Approximately Equal (Python) 2010-03-17T17:05:51-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/577124-approximately-equal/ <p style="color: grey"> Python recipe 577124 by <a href="/recipes/users/4172944/">Steven D'Aprano</a> (<a href="/recipes/tags/comparisons/">comparisons</a>, <a href="/recipes/tags/distance/">distance</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/maths/">maths</a>, <a href="/recipes/tags/numeric/">numeric</a>, <a href="/recipes/tags/string/">string</a>). </p> <p>Generic "approximately equal" function for any object type, with customisable error tolerance.</p> <p>When called with float arguments, approx_equal(x, y[, tol[, rel]) compares x and y numerically, and returns True if y is within either absolute error tol or relative error rel of x, otherwise return False. The function defaults to sensible default values for tol and rel.</p> <p>For any other pair of objects, approx_equal() looks for a method __approx_equal__ and, if found, calls it with arbitrary optional arguments. This allows types to define their own concept of "close enough".</p> Calculate distance from .kmz files (Python) 2009-05-31T23:59:34-07:00Michal Niklashttp://code.activestate.com/recipes/users/186902/http://code.activestate.com/recipes/576782-calculate-distance-from-kmz-files/ <p style="color: grey"> Python recipe 576782 by <a href="/recipes/users/186902/">Michal Niklas</a> (<a href="/recipes/tags/distance/">distance</a>, <a href="/recipes/tags/geocoding/">geocoding</a>, <a href="/recipes/tags/google_earth/">google_earth</a>, <a href="/recipes/tags/kmz/">kmz</a>, <a href="/recipes/tags/points/">points</a>). Revision 2. </p> <p>Calculates distance in kilometers from points saved in .kmz file. Such files can be created by Google Earth</p>