Modify values of a list while iterating over it in Python?
<p>For example:</p>

<pre><code>def update_condition(self, type, params):
    for condition in self.conditions:
        condition_loaded = json.loads(condition)
        if condition_loaded['type'] == type:
            condition_loaded['params'] = params
            condition = json.dumps(condition_loaded)
</code></pre>

<p>The above code does nothing because condition isn't by reference. What's the proper way to do this?</p>
