I have a class like this:
class someClass():
list_of_stuff = []
def __init__(self, *args):
print('length of list is ' + str(len(self.list_of_stuff)))
#LIST SHOULD BE EMPTY, RIGHT????
append stuff to the list...
I’m creating these objects in a for each loop, and the printout reveals that the list isn’t empty with each iteration.
for item in another_list:
temp_obj = someClass()
temp_obj.do_stuff()
What’s going on here? Isn’t a NEW object being created in each run of the for loop, therefore its data members should be empty? Am I mis-using init?