Searching equivalent to C++ RAII or deterministic destructors

Tim Roberts timr at probo.com
Fri Jul 3 22:20:18 CEST 2009


Dave Angel <davea at dejaviewphoto.com> wrote:
>   
>You're right of course.  What I was trying to say was it deletes the 
>reference to the object.  Unlike obj = None, del obj removes the 
>reference (attribute) entirely. Although I don't know what it should be 
>called if it's a local variable.  Perhaps it "unbinds" the name.

Yes.  As far as the object is concerned, "obj = None" and "del obj" are
exactly identical.  In both cases, there is one less binding to the name.

The difference between the two is only whether the name lives on in the
namespace.

A local variable is (usually) just a name in the local() namespace.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list