I used to think that python used to work with references or respectively with copies of references when values are passed as function arguments.
Now I tried the following example and do not understand anything anymore even after reading a bit up on the topic.
import numpy as np
import networkx as nx
graph = nx.DiGraph()
test = np.array([1, 1, 1], dtype=np.bool)
graph.add_edge(1, 2, data=True)
print graph[1][2]['data'] # shows True as expected
graph[1][2]['data'] = test[0]
print graph[1][2]['data'] # shows True as expected. Still fine
test[0] = False
print graph[1][2]['data'] # shows True instead of False
Shouldn't it then print False? I thought that assignement would make the graph[1][2]['data'] point to test[0]. However it seems that it actually uses references to True and False and I seem to don't really understand pythonic assignment.
Is there a way how to make it point to the specific entry of the array or is this impossible in python? And not to the content of the array entry?