min
builtin PTC-W0041ets = min(ets, archive_end)
instead of the unnecessary if block 62
63 ets = sane_date(y2, m2, d2)
64 archive_end = datetime.date.today() - datetime.timedelta(days=1)
65 if ets > archive_end: 66 ets = archive_end
67
68 return [sane_date(y1, m1, d1), ets]
It is unnecessary to use an if
statement to check the minimum of two values and then assign the value to a name.
You can use the min
built-in do do this. It is straightforward and more readable.
Not preferred:
if value >= 10:
value = 10
Preferred:
value = min(value, 10)