On Apr 19, 2010, at 4:05 PM, wb wrote:
On Apr 20, 12:25 am, Robert Bradshaw
wrote:
On Apr 19, 2010, at 2:50 PM, wb wrote:
coming from C I'm confused about this behavior in assignment:
Since you know C, it may make sense to think of lists as being
similar
to pointers.
that makes sense
that makes sense - I guess I was expecting lists to behave like list
*classes* which have an overloaded assignment operator.
Turning this around: is there a 'list-like' data type in sage which
has 'true' assignment, i.e. copying all its content
The module copy allows you to make a real copy as i
On Apr 20, 1:05 am, wb wrote:
> Turning this around: is there a 'list-like' data type in sage which
> has 'true' assignment, i.e. copying all its content ?
That's actually a python question. I think it would be rather
confusing if the assignments would change, especially if it is a
native list. T
On Apr 20, 12:25 am, Robert Bradshaw
wrote:
> On Apr 19, 2010, at 2:50 PM, wb wrote:
>
> > coming from C I'm confused about this behavior in assignment:
>
> Since you know C, it may make sense to think of lists as being similar
> to pointers.
>
that makes sense - I guess I was expecting lists
Here is the way that I do this when I want copy vs reference for
lists.
>>> a = [1,2]
>>> b = a[:]
>>> b[0] = a[0] + b[0]
>>> b
[2, 2]
>>> a
[1, 2]
>>>
the a[:] does a copy of the list while a=b creates a reference. It is
a little hard to get used to at first.
On Apr 19, 2:50 pm, wb wrote:
> c