[Python-Dev] Overwriting objects before deallocating them

Guido van Rossum guido@python.org
Fri, 24 May 2002 12:22:33 -0400


> [Guido]
> > ...
> > The new/del names are partly borrowed from C++, where new and delete
> > are the memory (de)allocation operators as well as the object
> > (de)allocation operators.
> 
> I know, but as a former C++ programmer, that's what I keep tripping over:
> "del" in C++ does a lot more than just release memory (just as "new" in C++
> does a lot more than just allocate memory -- and it may not allocate memory
> at all).  OTOH, "del" in Python doesn't release memory.  So "del" in
> Python's C API doesn't match what Python or C++ mean by it.  As far as I'm
> concerned, the instant you don't type "malloc" literally you should already
> be well aware that you're not necessarily calling malloc literally <wink>.

Yup, it's a mess, forever.

--Guido van Rossum (home page: http://www.python.org/~guido/)