Python: Understanding object __del__ method
<p>Can anyone describe me why this code will print '2 1 0 done' instead of expected output '0 1 2 done'? 
As i can understand, we have some anonymous variables creating during list comprehensions, and they are garbage-collected, using filo principle, on list comprehension uncoverage end.
But, they still are referenced in list aa, aren't they?
Why the second 'del a' is not calling <strong>del</strong> magic method in that case?</p>

<pre><code>class A:
    def __init__(self, name):
        self.name = name
    def __del__(self):
        print self.name,

aa = [A(str(i)) for i in range(3)]
for a in aa:
    del a

print 'done'
</code></pre>

<p>Also, advanced questions. Please look at <a href="http://codepad.org/niaUzGEy" rel="nofollow">http://codepad.org/niaUzGEy</a>
Why there are 5 copies, 3 copies? Musn't this be 1 copy? Why 5 or 3? Dont know, thats why asking it ;)
Thanks for your time!</p>
