Say I have code like this:
I am declaring a new AlmEntry class instance and assigning it to tmpentry in the loop. I do some validation on it and then I insert it into an array.
Is this valid, or should I actually be using a copy or deepcopy? The code works as I intend the way it is now, but I am just wondering if I might see problems doing it this way or if this is right.
Code:
almentries = [];
files = os.listdir(path)
for f in files:
tmpentry = AlmEntry(f);
if tmpentry.Load() :
print("valid load");
almentries.append(tmpentry);
else:
print("invalid load");
I am declaring a new AlmEntry class instance and assigning it to tmpentry in the loop. I do some validation on it and then I insert it into an array.
Is this valid, or should I actually be using a copy or deepcopy? The code works as I intend the way it is now, but I am just wondering if I might see problems doing it this way or if this is right.
