title: How to implement distance between different types in a pythonic way
body: <p>Let's say I have different types like:</p>
  
  <pre><code>Point 
  Circle 
  Rectangle
  Polyline
  Circle_Collection
  Rectangle_collection
  </code></pre>
  
  <p>etc</p>
  
  <p>I want to be able to measure the distance between any combination of the types mentioned above. The easiest way would be to implement a distance method inside each of the classes:</p>
  
  <pre><code>class Point:
     def distance(self, other):
        if other is Point:
           # handle points
        if other is Circle:
           # handle circles
  </code></pre>
  
  <p>But then I thought it would be better to implement it as a free function because the distance to another objects is not really an inherent information about a class.</p>
  
  <p>So lets say i would implement distance in a way that i can call it like</p>
  
  <pre><code>p = Point()
  c = Cirle()
  print distance(p,c)
  </code></pre>
  
  <p>What is the best way to do it? I have heard that function overloading isn't really a pythonic way to do things. What would be pythonically correct?</p>