-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I like the spirit of Section 3.3 but not so much the delivery.
In the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions
def load_inflammation_data(dir_path): ...
def analyse_data(data_dir): ...I would think it would make some sense to completely decouple these two functions so that when they are used, a user would do something like
data = load_inflammation_data("/path/to/data")
result = analyse_data(data)but instead the example leaves the load_inflammation_data call inside analyse_data. This isn't the worst thing in the world to do but I would think that separating them would be better?
Then in the next example they suggest going more towards this approach, but by introducing a class CSVDataSource. This seems a little pointless to me, and in fact Pylint would complain about this class having too few methods (R0903)! And in the end they still pass that class to the function and rely on duck typing to load the data...