def list_records(username): result = [] for k in book.keys(): record = book.record(k) if record['NAME'] == username: result.append(record) return result
def print_records(username): for k in book.keys(): record = book.record(k) if record['NAME'] == username: print record['TEXT']
def generator_records(username): for k in book.keys(): record = book.record(k) if record['NAME'] == username: yield record
def comprehensio_2_records(username): return (record for record in (book.record(k) for k in book.keys()) if record['NAME'] == username)
def comprehensio_1_records(username): return [record for record in [book.record(k) for k in book.keys()] if record['NAME'] == username]