bharadwaj-raju / WeatherDesk

MOVED: https://gitlab.com/bharadwaj-raju/WeatherDesk
https://gitlab.com/bharadwaj-raju/WeatherDesk
GNU General Public License v3.0
217 stars 31 forks source link

Various minor optimizations #13

Closed cclauss closed 8 years ago

bharadwaj-raju commented 8 years ago

While the first part of the optimizations is great, I can't say the same with the rest -- the optimizations in get_time_of_day() and check_if_all_files_exist().

The modifications in get_time_of_day() just make it harder to read - compare:

return 'evening' if 17 <= current_time.hour < 20 else 'night'

with

elif current_time.hour in range(17, 20):
    return 'evening'
else:
    return 'night'

While the first one is just one-line, it is hard to read.

And as for check_if_all_files_exist(), I can't see what advantage

required_files = 'rain snow normal cloudy wind thunder'.split()

would have over a simple

required_files = ['rain', 'snow', 'normal', 'cloudy', 'wind', 'thunder']

I'd like to merge only the first part of this.

cclauss commented 8 years ago

Closed in favor of https://github.com/bharadwaj-raju/WeatherDesk/pull/17