In article <ftps459nklqio3nghaaraniqo3fs9r8...@4ax.com>,
Tim Roberts  <t...@probo.com> wrote:
>Dave Angel <da...@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.

OTOH, Python's ``del`` applies to targets generally, not just names:

>>> L = [1,2,3]
>>> del L[1]
>>> L
[1, 3]
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to