36-650-Fall-2020 / fp-unit-test-assignment-YixuanLuo98

fp-unit-test-assignment-YixuanLuo98 created by GitHub Classroom
1 stars 0 forks source link

immutability issue #4

Open alexazhu opened 3 years ago

alexazhu commented 3 years ago

Refer to line16-21 in readers.py:

def print_cumm_information(data, start_date, end_date, name, region): print("Time Range: " + start_date + " - " + end_date) if data is us: data = data else: data = data[data[region] == name]

the status of data is changing in this case that might jeopardize the immutability of pure functions. Could create another var to store the "data" or just pass the value directly to the cumm_cases function. Thanks.

YixuanLuo98 commented 3 years ago

Good point! When I create the "if-else" function within this print_cumm_information(), I was trying to avoid duplicated functions defined for the same functionality. As in the fact that I need three cumm_info() for us, states, and counties. Yes, I agree with you that one possible way to fix this is to define the variables to be inserted before the function. Do you think it might also be better for me to read the files in a different way to extract the information for filtering purposes easier? Thanks!!