I think what William meant to say is that lists and dictionaries are  
mutable. When you do LL = L, both LL and L point to the same actual  
list, so things you do to the one are reflected in the other. When  
you do LL = 2*L, it's making a completely new list.

This is a Python thing, not specific to Sage, so perhaps one of the  
Python tutorials would be a more complete place to start for  
questions like this (and Python is useful to know on its own too).

- Robert


On Nov 4, 2008, at 11:51 AM, Stan Schymanski wrote:

> Hi William,
>
> Thanks for the clarification. I think I see a bit of a light in the  
> fog.
> So since lists and dictionaries are immutable objects, any  
> references to
> them must always refer to the same thing. Consequently, if the  
> result of
> the reference is to be changed, the object itself has to change. Did I
> get this right? I still struggle to understand the difference between
> LL=L and LL=2*L. Is there a section in the tutorial or reference that
> could help?
>
> Thanks,
> Stan
>
> William Stein wrote:
>> The behavior is identical -- both assignments create a new reference,
>> as do *all* assignments in Python.  The difference is merely that
>> lists and dictionaries are immutable whereas symbolic variables
>> aren't.
>>
>> William
>>
>>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to