title: Implicit vs Explicit Object-Method Memory Benchmark Differences
body: <p>I ran benchmarks on two different methods of passing an object to a method and the implicit object passing took less time than the explicit method. My book says these are identical processes. What explains the difference?</p>
  
  <p>First, here's the class definition:</p>
  
  <pre><code>class Point:
      def reset(self)
          self.x = 0
          self.y = 0
  </code></pre>
  
  <p>So, when I run 'timeit' on each of the following two sets of code the first returns 317 ns per loop and the second returns 400 ns per loop. Here's the implicit object-method passing code, where Python passes the object to the method behind the scenes:</p>
  
  <pre><code>p = Point()
  p.reset()
  </code></pre>
  
  <p>And here's the explicit alternative: </p>
  
  <pre><code>p = Point()
  Point.reset(p)
  </code></pre>
  
  <p>Can someone tell me what's going on at the memory allocation level that explains the benchmark difference? Is one way more 'pythonic' than the other? Why would a programmer choose one over the other (beyond the speed)?</p>
  
  <p>Thank you,</p>
  
  <p>Michael</p>