I have the following Python code. I was expecting the dictionary of the object node1 to have values 'a','b' and the dictionary of object node2 to have values 'c','d'. But am getting the output - ([['a'], ['b'], ['c'], ['d']]) - in both the cases. Why is it that the dictionaries of two distinct objects (node1 and node2) acting as if there is only one single dictionary?
class Node:
Dictionary={}
def main():
node1 = Node()
node2 = Node()
node1.Dictionary.setdefault(1, []).append('a')
node1.Dictionary.setdefault(2, []).append('b')
node2.Dictionary.setdefault(3, []).append('c')
node2.Dictionary.setdefault(4, []).append('d')
print("Node 1 ",node1.Dictionary.values())
print("Node 2 ",node2.Dictionary.values())
main()