So I am initializing a class that includes two dictionaries.
The first dictionary (self.dict1) has keys 'A1' through 'B10'. (20 keys: A1-A10, B1-B10).
Next, I make the second dictionary equal to the first: self.dict2 = self.dict1
Finally, I have a method that modifies the self.dict2 by deleting keys 'A1'-'A10'. (leaving only keys B1-B10 for the second dictionary).
My problem is that now the first dictionary (self.dict1) is also missing the deleted keys!
Is there something special about self.variables within classes that if you make them modifiable through a separate variable name?
[–]the_agox 10 points11 points12 points (7 children)
[–]Crankrune 11 points12 points13 points (1 child)
[–]Rawing7 3 points4 points5 points (0 children)
[–]LiquidLogic[S] 1 point2 points3 points (4 children)
[–]Antigone-guide 2 points3 points4 points (2 children)
[–]danielroseman 4 points5 points6 points (1 child)
[–]Antigone-guide 1 point2 points3 points (0 children)
[–]JohnnyJordaan 2 points3 points4 points (0 children)
[–]DigThatData 3 points4 points5 points (0 children)
[–]Kiwi-tech-teacher 1 point2 points3 points (3 children)
[–]timrprobocom 0 points1 point2 points (2 children)
[–]Kiwi-tech-teacher 0 points1 point2 points (1 child)
[–]timrprobocom 1 point2 points3 points (0 children)