diff --git a/data/shipdict.py b/data/shipdict.py index eb9168a0..cebcdc5f 100755 --- a/data/shipdict.py +++ b/data/shipdict.py @@ -72,9 +72,9 @@ def __hash__(self): # a hashable shall override this special method def __eq__(self, other): - return self.latitude == other.latitude\ - and self.longitude == other.longitude\ - and self.timestamp == other.timestamp + return (self.latitude == other.latitude + and self.longitude == other.longitude + and self.timestamp == other.timestamp) # @END@ # @BEG@ name=shipdict more=suite @@ -108,7 +108,7 @@ def add_position(self, position): def sort_positions(self): """ sort of positions made unique thanks to the set by chronological order - for this to work, a Position shall be hashable + for this to work, a Position must be hashable """ self.positions = sorted(set(self.positions), key=lambda position: position.timestamp) @@ -173,6 +173,11 @@ def add_chunk(self, chunk): based on the result of is_abbreviated(), gets sent to add_extended or add_abbreviated """ + # here we retrieve the static method through the class + # this form outlines the fact that we're calling a static method + # note that + # self.is_abbreviated(chunk) + # would work fine just as well if ShipDict.is_abbreviated(chunk): self.add_abbreviated(chunk) else: