# HG changeset patch # User Paul Boddie # Date 1317565961 -7200 # Node ID d3776f8ba4326b76ff7556af7212c868174a051c # Parent 48a194ecc68c42b32cb80f7b43a598c67582cfc0 Changed readers to act like iterable objects instead of providing get_records methods. diff -r 48a194ecc68c -r d3776f8ba432 simplex/__init__.py --- a/simplex/__init__.py Sat Oct 01 16:01:22 2011 +0200 +++ b/simplex/__init__.py Sun Oct 02 16:32:41 2011 +0200 @@ -46,7 +46,7 @@ current_key = None start_pos = 0 - for i, record in enumerate(reader.get_records()): + for i, record in enumerate(reader): key = accessor.get_key(record) # Where duplicate keys are permitted, the first record employing the key @@ -100,7 +100,7 @@ employing the term or None if no such record was found. """ - for record in reader.get_records(): + for record in reader: key = accessor.get_key(record) if term == key: return record diff -r 48a194ecc68c -r d3776f8ba432 simplex/readers.py --- a/simplex/readers.py Sat Oct 01 16:01:22 2011 +0200 +++ b/simplex/readers.py Sun Oct 02 16:32:41 2011 +0200 @@ -28,8 +28,8 @@ def seek(self, pos): self.f.seek(pos) - def get_records(self): - return self.f.xreadlines() + def __iter__(self): + return iter(self.f.xreadlines()) class DelimitedRecord: