Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > On Fri, 14 Apr 2006 09:17:05 +0400, Sergei Organov <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> I, as a newcomer, don't have much trouble understanding the binding vs >> the assignment by themselves. What does somewhat confuse is dual role of >> the "=" operator, -- sometimes it means "bind" and other times it means >> "assign", right? For me it seems that the language would be less > > It always means bind... But if the LHS is a mutable object, AND you > have specified a component of that object, it is the component that is > being rebound... > > lst[:] = [] > > is rebinding the elements inside the list "lst", and not rebinding the > name "lst". Essentially, once you add any "selector" to the name > (object[...]= or object.xxx=) you are going "inside" the object, and > manipulating (rebinding) what is inside. If the name is used "pure" > (object=), you are rebinding the /name/ to a different object.
Me gets corrected, thanks. Now I need to unroll my mind somewhat back to figure out when and why I started to believe it sometimes assigns ;) -- Sergei. -- http://mail.python.org/mailman/listinfo/python-list