Searching equivalent to C++ RAII or deterministic destructors

Dave Angel davea at dejaviewphoto.com
Thu Jul 2 15:21:40 CEST 2009


Christian Heimes wrote:
> Dave Angel wrote:
>   
>> Look also at 'del' a command in the language which explicitly deletes an
>> object.
>>     
>
> No, you are either explaining it the wrong way or you have been fallen
> for a common misinterpretation of the del statement. The del statement
> only removes the object from the current scope. This means it decreases
> the reference count by one. It does *not* remove the object.
>
> Christian
>
>
>   
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.

DaveA




More information about the Python-list mailing list