Newbie Newbie, we are all Newbie to something
moshez at math.huji.ac.il
Fri Feb 25 14:49:15 CET 2000
On Fri, 25 Feb 2000, Gregoire Welraeds wrote:
> I'm currently reading the Python Reference Manual and I got a small
> question regarding the __del__() statement in a class definition.
Well, Python, the language, does not gurantee *anything* about memory
freeing and __del__ calling except that it will not delete an object
as long as any reachable object references it, and that it will not call
the __del__ method as long as any reachable object references it.
CPython, the implementation (well, one of the implementations, anyway),
deletes an object as soon as there are no references to it, and it calls
it's __del__ method right before that. (I'm not talking about what happens
if the __del__ resurrects an object. It's a user bug.)
f = open("file")
Closes the file *in the current C implementation*. It does not close
the file, e.g., in JPython.
have-I-confused-you-enough-yet-ly y'rs, Z.
Moshe Zadka <mzadka at geocities.com>.
INTERNET: Learn what you know.
Share what you don't.
More information about the Python-list