Objects does not include methods in the list comprehension
问题 This question is related to my previous question and Bill's response there. I have a class named StrucData in subfile.py class StrucData: def __init__(self, name): self.name=name def loadData(self, size=1, cost=1): self.size=size self.cost=cost return self In the main file I: call the subfile, create a list of data names loop through the list to instantiate the objects; and load data using 'loadData' method for each object (I'm using the same 'size' and 'cost' to make this example easy.) in