Hi, Stan,
On Nov 4, 2008, at 00:47 , Stan Schymanski wrote:
Sorry, I should have looked around a bit more. If I replace pars1 =
pars
by pars1 = pars.copy() in the below code, the two dictionaries are
independent.
You found part of the story, but there's a bit more. Consider this
Thanks a lot, Justin! That's good to know. Incidentally, isn't it a bit
inconsistent to have different behaviour for assignments related to
lists and dictionaries than those related to symbolic variables?
Example:
sage: L1=[1,2,3];L2=[3,4,5]
sage: L=[L1,L2]
sage: L
[[1, 2, 3], [3, 4, 5]]
On Tue, Nov 4, 2008 at 9:03 AM, Stan Schymanski [EMAIL PROTECTED] wrote:
Thanks a lot, Justin! That's good to know. Incidentally, isn't it a bit
inconsistent to have different behaviour for assignments related to
lists and dictionaries than those related to symbolic variables?
The behavior
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
Sorry, I should have looked around a bit more. If I replace pars1 = pars
by pars1 = pars.copy() in the below code, the two dictionaries are
independent.
Stan
Stan Schymanski wrote:
Dear all,
I tried to store sets of parameter values for plotting in
dictionaries, but the dictionaries do
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
Hi Stan,
On Tue, Nov 4, 2008 at 11:51 AM, Stan Schymanski [EMAIL PROTECTED] wrote:
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.
William had a typo in
Hi, Jason,
On Nov 4, 2008, at 14:38 , Jason Bandlow wrote:
Hi Stan,
I think I saw one question you asked that hasn't been answered yet:
Stan Schymanski wrote:
snip
If I construct a list out of two other lists, I usually don't
expect the original lists to change if I manipulate the