Dynamic field insertion when creating python dictionary
<p>I would like to dynamicly add/ don't add a field when creating a python dictionary.</p>

<pre><code>def my_func(input):
    return {
         'foo':'bar',
         None if input == None else 'baz':input
        }
</code></pre>

<p>This actually works but it returns <code>{'foo': 'bar', None: None}</code></p>

<p>I would like it to return <code>{'foo': 'bar'}</code>. Is there a way to do that?</p>

<p>PS. I know this question is a bit academic. One could easily do:</p>

<pre><code>def my_func(input):
    ret = {
         'foo':'bar',
            }
    if input != None:
        ret['baz'] = input
    return ret
</code></pre>

<p>but I like the first one for cleanness.</p>

<p>[EDIT]</p>

<p>Could we use an <code>__metaclass__</code> to solve this?</p>
