List &reference to segment of another list. Can dis be done?

Ivan discuss at fieryorb.com
Wed May 29 11:37:33 EDT 2002


I tried many logical ways to accomplish this (something like this):
I want to create some list, like:

>>> li = [0, 1, 2, 4, 8,]

...then I'd like to create reference list to segment of previous list, like

>>> re = (ref) li[2:]
>>> re
[2, 4, 8]

so, that when I ...

re = [16, 32, 64]

I'd like to have original list changed into [0, 1, 16, 32, 64].
Anybody who doesn think this problem is ironic or so, please advice.
Thank you



More information about the Python-list mailing list