First use-case of the walrus operator

September 26, 2022

def calculate_frequency_dates(start, end, offset):
    values = []
    current = start
 
    while (new := (current + offset).date()) <= end:
        values.append((current, new))
        current = new
 
    return values