Why deepcopy doesnt create new references to lambda function?
<p>Found this strange in python:</p>

<pre><code>class SomeClass():
    def __init__(self):
        pass

a = [SomeClass()]
b = copy.deepcopy(a)
</code></pre>

<p>Output:</p>

<pre><code>&gt;&gt;&gt; a
[&lt;__main__.Some instance at 0x10051b1b8&gt;]
&gt;&gt;&gt; b
[&lt;__main__.Some instance at 0x10051b092&gt;]
</code></pre>

<p>This is just as expected- deepcopy created new <code>SomeClass()</code> object for b.</p>

<p>But if,</p>

<pre><code>f = lambda x:x+1
a = [f]
b = copy.deepcopy(a)
</code></pre>

<p>I get:</p>

<pre><code>&gt;&gt;&gt; a
[&lt;function &lt;lambda&gt; at 0x10056e410&gt;]
&gt;&gt;&gt; b
[&lt;function &lt;lambda&gt; at 0x10056e410&gt;]
</code></pre>

<p>Why deepcopy doesnt create a new lambda instance in the second case? does that mean lambda functions are atomic?</p>
