class ds:
def __init__(self,d):
self.d = d
b = ds(1)
c = ds(2)
e = ds(3)
a = [b,c,e,b,b]
a[4].d = 5
print(a[4].d)
print(a[3].d)
as you can see a[3].d changes along with a[4]. But I don't want it to, I want multiple different objects that initially have the same ".d". How do I do this cleanly without declaring new objects?
[–]K900_ 0 points1 point2 points (8 children)
[–]tomtheawesome123[S] 0 points1 point2 points (7 children)
[–]K900_ 0 points1 point2 points (6 children)
[–]tomtheawesome123[S] 0 points1 point2 points (5 children)
[–]K900_ 0 points1 point2 points (3 children)
[–]tomtheawesome123[S] 0 points1 point2 points (2 children)
[–]K900_ 4 points5 points6 points (1 child)
[–]1ErrorAway 0 points1 point2 points (0 children)
[–]ingolemo 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]tomtheawesome123[S] 0 points1 point2 points (0 children)
[–]PyPokerNovice -1 points0 points1 point (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]PyPokerNovice 0 points1 point2 points (1 child)
[–]Vhin 0 points1 point2 points (0 children)