Is there a way to do what I’m trying to do here:
for item in [self.docket_numbers, self.neutral_citations,
self.lower_courts, self.lower_court_judges,
self.dispositions, self.judges, self.nature_of_suit]:
if item is not None:
item = [clean_string(sub_item) for sub_item in item]
Obviously, in the last line, I need to assign the result of the list interpretation back to the object…but I’m not sure how.
If the various items are lists, which it kind of looks like they are, you don’t need setattr, you can simply change them in-place: