From 85fbec787a71f4f97c61211ad2ec256cb5c8bcdc Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Sat, 13 Feb 2016 11:03:13 -0500 Subject: [PATCH] Switch to index access for idiomaticity --- records.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/records.py b/records.py index bea5fa2..5afc071 100644 --- a/records.py +++ b/records.py @@ -205,16 +205,16 @@ class RecordCollection(object): # Try to get a record, or return default. try: - record = next(self) - except StopIteration: + record = self[0] + except IndexError: if isexception(default): raise default return default # Ensure that we don't have more than one row. try: - next(self) - except StopIteration: + self[1] + except IndexError: pass else: raise ValueError('RecordCollection contains too many rows.')