Re: How to append a modified list into a list?

2016-11-19 Thread jfong
Peter Otten at 2016/11/19 5:40:34PM wrote: > And now for something completely different ;) > > What if you only record the changes to the list? For a long list that would > save space at the expense of calculation time. For example: Excellent! Although not 100% fit into my application, I must

Re: How to append a modified list into a list?

2016-11-19 Thread Peter Otten
jf...@ms4.hinet.net wrote: > I have a working list 'tbl' and recording list 'm'. I want to append 'tbl' > into 'm' each time when the 'tbl' was modified. I will record the change > by append it through the function 'apl'. > > For example: > tbl=[0,0] m=[] > tbl[0]=1 apl(tbl)

Re: How to append a modified list into a list?

2016-11-18 Thread jfong
Oh, I don't know slice well enough:-( So, slice tbl[:] will create a new object (a copy of tbl) which can be passed as a function argument m.append(tbl[:]) or bind to a new name w=tbl[:] or re-bind to itself w[:]=tbl Thanks you, Ian and Steve. Steve D'Aprano at 2016/11/19 11:01:26AM wrote: >

Re: How to append a modified list into a list?

2016-11-18 Thread Steve D'Aprano
On Sat, 19 Nov 2016 12:44 pm, jf...@ms4.hinet.net wrote: > I have a working list 'tbl' and recording list 'm'. I want to append 'tbl' > into 'm' each time when the 'tbl' was modified. I will record the change > by append it through the function 'apl'. [...] > Obviously the most intuitive way

Re: How to append a modified list into a list?

2016-11-18 Thread Ian Kelly
On Nov 18, 2016 6:47 PM, wrote: I have a working list 'tbl' and recording list 'm'. I want to append 'tbl' into 'm' each time when the 'tbl' was modified. I will record the change by append it through the function 'apl'. For example: >>>tbl=[0,0] >>>m=[] >>>tbl[0]=1

How to append a modified list into a list?

2016-11-18 Thread jfong
I have a working list 'tbl' and recording list 'm'. I want to append 'tbl' into 'm' each time when the 'tbl' was modified. I will record the change by append it through the function 'apl'. For example: >>>tbl=[0,0] >>>m=[] >>>tbl[0]=1 >>>apl(tbl) >>>m [[1,0]] >>>tbl[1]=2 >>>apl(tbl) >>>m