Switch to index access for idiomaticity

This commit is contained in:
Chad Whitacre
2016-02-13 11:03:13 -05:00
parent fafaca6a96
commit 85fbec787a
+4 -4
View File
@@ -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.')