Re: Efficient implementation of deeply nested lists

2006-01-20 Thread Kay Schluehr
Bengt Richter wrote: On 19 Jan 2006 01:19:06 -0800, Kay Schluehr [EMAIL PROTECTED] wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L =

Efficient implementation of deeply nested lists

2006-01-19 Thread Kay Schluehr
I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN, [x]]...]] The value of x is the only one to be changed. With each value of

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Fuzzyman
Kay Schluehr wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN, [x]]...]] The value of x is the only one to be

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Peter Otten
Kay Schluehr wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN, [x]]...]] The value of x is the only one to be

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Kay Schluehr
Peter Otten wrote: Kay Schluehr wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN, [x]]...]] The value

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Peter Otten
Kay Schluehr wrote: The structure of the sequence is not optional. Of course you can also take the original sequence and apply: L = list([a1, [a2, [[aN, [x]]...]])  # shallow copy L[0] = b I don't understand the example. Wouldn't you have to do L[1][1]...[1] = b to change x? but

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Bryan Olson
Kay Schluehr wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN, [x]]...]] The value of x is the only one to be

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Bengt Richter
On 19 Jan 2006 01:19:06 -0800, Kay Schluehr [EMAIL PROTECTED] wrote: I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = [a1, [a2, [[aN,