title: Non-member vs member functions in Python
body: <p>I'm relatively new to Python and struggling to reconcile features of the language with habits  I've picked up from my background in C++ and Java.  </p>
  
  <p>The latest issue I'm having has to do with encapsulation, specifically an idea best summed up by Item 23 of Meyer's "<em>Effective C++</em>":</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/5989734/effective-c-item-23-prefer-non-member-non-friend-functions-to-member-functions">Prefer non-member non-friend functions to member functions</a>.</p>
  </blockquote>
  
  <p>Ignoring the lack of a <code>friend</code> mechanism for a moment, <strong>are non-member functions considered preferable to member functions in Python</strong>, too?</p>
  
  <p>An obligatory, asinine example:</p>
  
  <pre><code>class Vector(object):
      def __init__(self, dX, dY):
          self.dX = dX
          self.dY = dY
  
      def __str__(self):
          return "-&gt;(" + str(self.dX) + ", " + str(self.dY) + ")"
  
      def scale(self, scalar):
          self.dX *= scalar
          self.dY *= scalar
  
  def scale(vector, scalar):
      vector.dX *= scalar
      vector.dY *= scalar
  </code></pre>
  
  <p>Given <code>v = Vector(10, 20)</code>, we can now either call <code>v.scale(2)</code> or <code>scale(v, 2)</code> to double the magnitude of the vector.</p>
  
  <p>Considering the fact that we're using properties in this case, <strong>which of the two options - <em>if any</em> - is better, and why?</strong></p>