[Python-Dev] Overwriting objects before deallocating them

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


[Tim]
> I'm not sure why, but there's a widespread intransigent belief that
> it's somehow purer to say "del" for freeing memory that happened to
> hold an object.

I'm the origin of this convention; it was part of Python 0.0.
Switching from [m]alloc/free to new/del was *not* to differentiate
between mere blobs of memory and objects; it was to indicate that
these macros and functions were a layer on top of malloc/free.
(Originally, they merely changed the signature around a bit.)

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.

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