This is a follow up from my last question as to why the setattr within a class for a method did not work and I found an answer on it but now I have a small problem with it
class Test:
def myString(self, var):
Test.myString.string = var
return self.myString
I then do this
x = Test()
x.myString("test").string
It returns test but then I try this
y = list()
[y.append(x.myString(str(i))) for i in range(10)]
then try to get the list by doing this, [j.string for j in y]
and it returns 9 total digits of nine. Is their a way to fix this so it appends the number it's currently on?