Oct-04-2021, 08:26 AM
I have several variables in a list: - they are the result of ana analysis run using another library in python
Is it valid to do the following before the for loop in python? I know that attributes are set explicitly in classes, but for something minor like a string, is it valid to add a name attribute which is just a string descriptor to a variable?
thank you
vars = [run1, run2, run3, run4]I now need to run one more analysis in a for loop and save the objects within the for loop. For this reason, during the save, i want to add a name attribute to the variables so that I can have a convenient filename for each.
Is it valid to do the following before the for loop in python? I know that attributes are set explicitly in classes, but for something minor like a string, is it valid to add a name attribute which is just a string descriptor to a variable?
vars[0].name = 'name1'-- etc
thank you