I'm just trying to be more pythonic in my coding style and was wondering if this is a good way to get a list of seven days leading up to and including endDate:daysDelta   = 6lastSeven   = [endDate - datetime.timedelta(days=daysDelta)]for x in range(1,7):    myOffset    = daysDelta - x    lastSeven.append(endDate - datetime.timedelta(days=myOffset))
Getting a date range
python;datetime
You've hard-coded both 6 and 7, which means that if you either need to change the range, you'll have to change both numbers.  That's a bug waiting to happen.The most Pythonic way would be to use a list comprehension, so that you define the entire list at once, rather than appending one element at a time.daysDelta = 6lastSeven = [endDate - datetime.timedelta(days=days) for days in range(daysDelta, -1, -1)]