"Veek. M" <vek.m1...@gmail.com> writes: > 1. What are the rules for using __del__ besides: 'don't use it'.
What do you mean by “rules”? If you want advice on using that method, I don't think a canonical exhaustive “rules” set exists. For example: Use ‘__del__’ to mark an object as no longer used; don't expect that to result in the object actually going away at any particular point in time. > 2. What happens when I SystemExit? __del__ and gc are not invoked when > I SystemExit and there's a circular reference - but why? So that we can have a concrete example: Can you give a (very minimal and simple) example demonstrating the behaviour, so we can run it too? > 3. > import foo > def __del__(self, foo=foo): > foo.bar() That appears to be a module-level function. It is not a method of any class, so I am not clear on how it relates to garbage collection. > 4. also, are method calls more efficient than function calls? All method calls are function calls. This is because all methods are functions. -- \ “Unix is an operating system, OS/2 is half an operating system, | `\ Windows is a shell, and DOS is a boot partition virus.” —Peter | _o__) H. Coffin | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list