# Ensure that lengths match properly. assert len(self._keys) == len(self._values)
class RecordCollection(object): """A set of excellent Records from a query.""" def __init__(self, rows):#rows Record组成的列表 self._rows = rows self._all_rows = [] self.pending = True
def all(self, as_dict=False, as_ordereddict=False): """Returns a list of all rows for the RecordCollection. If they haven't been fetched yet, consume the iterator and cache the results."""
# By calling list it calls the __iter__ method rows = list(self)#这个写法有点意思,本质是调用self.__iter__不断产生对象