Skip to content

Commit 4efef9f

Browse files
committed
Revert "Add option my_range to method iterRecords"
This reverts commit e41b03c. JamesParrott pointed that I did not understand the way `__record` works: __record does not use oid to find the correct record, it just assumes it is the correct oid for the current position.
1 parent e41b03c commit 4efef9f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

shapefile.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ def records(self, fields=None):
18091809
records.append(r)
18101810
return records
18111811

1812-
def iterRecords(self, fields=None, my_range=None):
1812+
def iterRecords(self, fields=None):
18131813
"""Returns a generator of records in a dbf file.
18141814
Useful for large shapefiles or dbf files.
18151815
To only read some of the fields, specify the 'fields' arg as a
@@ -1820,9 +1820,7 @@ def iterRecords(self, fields=None, my_range=None):
18201820
f = self.__getFileObj(self.dbf)
18211821
f.seek(self.__dbfHdrLength)
18221822
fieldTuples, recLookup, recStruct = self.__recordFields(fields)
1823-
if my_range is None:
1824-
my_range = xrange(self.numRecords)
1825-
for i in my_range:
1823+
for i in xrange(self.numRecords):
18261824
r = self.__record(
18271825
oid=i, fieldTuples=fieldTuples, recLookup=recLookup, recStruct=recStruct
18281826
)

0 commit comments

Comments
 (0)