I have this code:
lengths = []
lengths.append(len(self.download_links))
lengths.append(len(self.case_names))
lengths.append(len(self.case_dates))
lengths.append(len(self.docket_numbers))
lengths.append(len(self.neutral_citations))
lengths.append(len(self.precedential_statuses))
Unfortunately, any of those object properties can be None
, so I need to check each with either an if not None
block or a try/except
block. Checking each individually will blow up the size and conciseness of the code.
I assume there must be a better way for this kind of pattern, right?