Skip to content

Commit 8e9352c

Browse files
committed
Just pass the iterator to the constructor, instead of list.extend
1 parent f9543e7 commit 8e9352c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/shapefile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,9 +3425,7 @@ def shapes(self, bbox: BBox | None = None) -> Shapes:
34253425
To only read shapes within a given spatial region, specify the 'bbox'
34263426
arg as a list or tuple of xmin,ymin,xmax,ymax.
34273427
"""
3428-
shapes = Shapes()
3429-
shapes.extend(self.iterShapes(bbox=bbox))
3430-
return shapes
3428+
return Shapes(self.iterShapes(bbox=bbox))
34313429

34323430
def iterShapes(self, bbox: BBox | None = None) -> Iterator[Shape | None]:
34333431
"""Returns a generator of shapes in a shapefile. Useful

0 commit comments

Comments
 (0)