Controlling assignation
harold fellermann
harold.fellermann at upf.edu
Mon Jun 13 13:36:48 EDT 2005
On 13.06.2005, at 19:23, Terry Reedy wrote:
>
> "harold fellermann" <harold.fellermann at upf.edu> wrote in message
> news:73cd19a37027b3d16c44d04ea560ee32 at upf.edu...
>
>> if you write
>>>>> a=A()
>> an instance of class A is created and bound to the local identifier
>> 'a'.
>
> I think it perhaps better to think of the label 'a' being bound to the
> object rather than vice versa. For one, a label can only be bound
> (stuck
> to, like a stick note) to one object at a time while one object can
> have
> many labels (and other references) stuck to it.
>
>> If you later write
>>>>> a=5
>> the object 5 is reassigned to the same identifier,
>
> Or one could say that the label 'a' is removed from the A() object and
> reassigned to the 5 object. Since the 5 object may have numerous other
> connections, and since those connections are unaffected by the new
> connection to 'a', whereas the previous assignment of 'a' is broken, I
> think it better to say that 'a' is being reassigned, not 5.
yeah. I have never seen it this way, but you are right! Binding the
identifier/label to the object is a much better perspective. thanks for
the lesson :)
- harold -
--
Ceci n'est pas une signature.
--
More information about the Python-list
mailing list