Tag Archives: __del__

Leaky method references

After reading my last post regarding __del__, you should know that __del__ + reference cycle = leak. Let’s say that you do need to use __del__, so you decide to avoid reference cycles. You write your code in such a … Continue reading

Posted in Python | Tagged , , , , | Leave a comment

Python Gotchas No. 2: Garbage Collection Oddities

Python is a garbage collected language. The garbage collector will collect orphaned objects. These are objects that have no references. If an object has a __del__ method, it will be called when that object is collected. Note however, that there … Continue reading

Posted in Programming, Python | Tagged , , , | 1 Comment

Python Gotchas 1: __del__ is not the opposite of __init__

After discussing my last post with a friend and talking about a few other issues, we came to the conclusion that it would be worthwhile to discuss more gotchas. First though, what is a gotcha? Wikipedia gives a good definition: … Continue reading

Posted in gotchas, Programming, Python | Tagged , , | 15 Comments