I want to clear the code that I wrote to scale the scale of what I'm trying to do. To do this, I would like to ideally create a list of links to objects so that I can systematically set objects using a loop without actually placing the objects in the list. I read about how Python handles links and passes them, but have not yet found a way to do this efficiently.
To better demonstrate what I'm trying to do:
I use bokeh and want to customize a large number of boxes of choice. Each block is as follows
select_one_name = Select( title = 'test', value = 'first_value', options = ['first_value', 'second_value', 'etc'] )
Customizing each choice is in order when I have only a few, but when I have 20, my code becomes very long and cumbersome. What I would like to do is a sample_list = [select_one_name, select_two_name, etc] list, which I then scroll to set values for each select_one_name , select_two_name , etc. However, I want to get the select_one_name link to still point to the correct value, and not to necessarily refer to the value by calling sample_list[0] .
I'm not sure if this is possible - if there is a better way to do this than to create a list of links, please let me know. I know that I could just create a list of objects, but I try to avoid this.
For reference, I'm on Python 2.7, Anaconda distribution, Windows 7. Thanks!
To follow @Alex Martelli's post below:
The reason I thought this might not work is because when I tried the mini test with a list of lists, I did not get the desired results. To demonstrate
x = [1, 2, 3] y = [4, 5, 6] test = [x, y] test[0].append(1)
The results are in x = [1, 2, 3, 1] , but instead I use test[0] = [1, 2] , then x remains [1, 2, 3] , although test itself reflects this change.
Drawing a parallel to my initial example, I thought that I would see the same results as from installation to equal. This is not true?