8000 Add _Record.__eq__ · GeospatialPython/pyshp@0fdcab1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0fdcab1

Browse files
committed
Add _Record.__eq__
1 parent a6c739a commit 0fdcab1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

shapefile.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,17 @@ def __dir__(self):
854854
) # plus field names (random order if Python version < 3.6)
855855
return default + fnames
856856

857+
def __eq__(self, other):
858+
return (isinstance(other, self.__class__) and
859+
self.__field_positions == other.__field_positions and
860+
self.oid == other.oid and
861+
len(self) == len(other) and
862+
all(val_self == val_other
863+
for val_self, val_other in izip(self, other)
864+
)
865+
)
866+
867+
857868

858869
class ShapeRecord(object):
859870
"""A ShapeRecord object containing a shape along with its attributes.

0 commit comments

Comments
 (0)
0