Re: [sage-support] Re: list vs. integer instances

2010-04-20 Thread Robert Bradshaw
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

Re: [sage-support] Re: list vs. integer instances

2010-04-20 Thread Laurent
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

[sage-support] Re: list vs. integer instances

2010-04-20 Thread Harald Schilly
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

[sage-support] Re: list vs. integer instances

2010-04-19 Thread wb
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

[sage-support] Re: list vs. integer instances

2010-04-19 Thread D. Monarres
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