From 8e9352c3334489d5d8f7255a181cb5d8abfeb8c0 Mon Sep 17 00:00:00 2001 From: James Parrott <80779630+JamesParrott@users.noreply.github.com> Date: Fri, 22 May 2026 20:58:27 +0100 Subject: [PATCH] Just pass the iterator to the constructor, instead of list.extend --- src/shapefile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/shapefile.py b/src/shapefile.py index 99db5c4..3dc9303 100644 --- a/src/shapefile.py +++ b/src/shapefile.py @@ -3425,9 +3425,7 @@ def shapes(self, bbox: BBox | None = None) -> Shapes: To only read shapes within a given spatial region, specify the 'bbox' arg as a list or tuple of xmin,ymin,xmax,ymax. """ - shapes = Shapes() - shapes.extend(self.iterShapes(bbox=bbox)) - return shapes + return Shapes(self.iterShapes(bbox=bbox)) def iterShapes(self, bbox: BBox | None = None) -> Iterator[Shape | None]: """Returns a generator of shapes in a shapefile. Useful