title: Updating SQLite table with Python function using table columns as arguments
body: <p>I am trying to <code>UPDATE</code> all records of a table with the results of a function which uses the other rows of the table as arguments. However, the result of this operation for all records is repeated from the first record. Can anyone explain why this might be the case?</p>
  
  <pre><code>def fun(a,b,c,d):
      return a + b + c + d
  
  cur = conn.cursor()
  
  cur.execute("SELECT field1, field2, field3, field4 FROM TABLE1")
  
  for row in cur:
          cur.execute("UPDATE TABLE1 SET field5 = ?", (fun(row[0],row[1],row[2],row[3]),))
  </code></pre>
  
  <p>The completed table looks like this:</p>
  
  <pre><code>field1, field2, field3, field4, field5
  4, 3, 2, 1, 10
  7, 3, 1, 0, 10
  8, 5, 2, 0, 10
  </code></pre>
  
  <p>When it should look like this:</p>
  
  <pre><code>field1, field2, field3, field4, field5
  4, 3, 2, 1, 10
  7, 3, 1, 0, 11
  8, 5, 2, 0, 15
  </code></pre>