Python won't eval() code
<p>I have the following eval() thing:</p>

<pre><code>c = Customer()
eval("c.name = row.value('customer', '{c}')".format(c=column_name), { 'c': c, 'row': row})
</code></pre>

<p>When I try to run that, I get this:</p>

<pre><code>Traceback (most recent call last):
  File "./import.py", line 19, in &lt;module&gt;
    c = Customer.save_from_row(row)
  File "/home/jason/projects/mcifdjango/mcif/models/customer.py", line 43, in save_from_row
    eval("c.name = row.value('customer', '{c}')".format(c=column_name), { 'c': c, 'row': row})
  File "&lt;string&gt;", line 1
    c.name = row.value('customer', 'name')
           ^
SyntaxError: invalid syntax
</code></pre>

<p>What am I doing wrong?</p>

<p>Edit: Because it looks like I didn't explain the context of my problem well enough, here's what I ended up doing, if anyone's curious:</p>

<pre><code>@classmethod
def save_from_row(cls, row):
    c = cls()
    map(lambda column_name: setattr(c, column_name, row.value('customer', column_name)), c.distinguishing_column_names())
    return c.upsert()
</code></pre>

<p>Before I found out about <code>setattr()</code> I was separately setting several different attributes on <code>c</code>.</p>
