title: Python Map Lamba Memory
body: <p>I have a list of objects, and I'd like to go through each object and change an attributed. Is there a difference in memory usage between (1) map lambda and (2) going through the list objects one by one. </p>
  
  <p>Here is a simple example code</p>
  
  <pre><code>class F(object):
      def __init__(self):
          self.ID = 0
  
      def set_ID(self):
          self.ID = 1
  
  number = 1000000
  list_objects = [F() for i in xrange(n)]
  </code></pre>
  
  <p>There are two ways of using <code>set_ID</code>:</p>
  
  <p>One way </p>
  
  <pre><code>map(lambda x: x.set_ID(), list_objects)
  </code></pre>
  
  <p>Another way </p>
  
  <pre><code>for obj in list_objects:
      obj.set_ID()
  </code></pre>