Efficient implementation of deeply nested lists
__peter__ at web.de
Thu Jan 19 10:12:31 EST 2006
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 = b
I don't understand the example. Wouldn't you have to do
L... = b
to change x?
> but it is intended to change the most inner element. I guess there is
> no way in doing it without a deepcopy / full list construction.
Yes, if you cannot change the nesting I don't see a way to avoid deepcopy
More information about the Python-list