From f5c9692a6bff734436fede8601be4e8841cae560 Mon Sep 17 00:00:00 2001 From: Adrien Ollier Date: Sat, 12 Dec 2020 19:23:47 +0100 Subject: [PATCH] aide des classes Position, Ship et ShipDict --- w6/w6-s8-x1-classes-merger.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/w6/w6-s8-x1-classes-merger.md b/w6/w6-s8-x1-classes-merger.md index 6516eb13..c0ab0bb4 100644 --- a/w6/w6-s8-x1-classes-merger.md +++ b/w6/w6-s8-x1-classes-merger.md @@ -404,12 +404,22 @@ En **niveau intermédiaire**, nous vous donnons ci-dessous un extrait de ce que | | Methods defined here: | + | __eq__(self, other) + | Return self==value. + | + | __hash__(self) + | Return hash(self). + | | __init__(self, latitude, longitude, timestamp) | constructor | | __repr__(self) | only used when merger.py is run in verbose mode | + | lat_str(self) + | + | lon_str(self) + | ``` +++ @@ -446,7 +456,8 @@ En **niveau intermédiaire**, nous vous donnons ci-dessous un extrait de ce que | to call `sort_positions` once you're done | | sort_positions(self) - | sort list of positions by chronological order + | sort of positions made unique thanks to the set by chronological order + | for this to work, a Position must be hashable ``` +++ @@ -496,16 +507,20 @@ En **niveau intermédiaire**, nous vous donnons ci-dessous un extrait de ce que | we might have ship instances with no name attached | This method removes such entries from the dict | - | is_abbreviated(self, chunk) - | depending on the size of the incoming data chunk, - | guess if it is an abbreviated or extended data - | | ships_by_name(self, name) | returns a list of all known ships with name | | sort(self) | makes sure all the ships have their positions | sorted in chronological order + | + | ---------------------------------------------------------------- + | Static methods defined here: + | + | is_abbreviated(chunk) + | depending on the size of the incoming data chunk, + | guess if it is an abbreviated or extended data + | ``` +++