Stephen Nelson-Smith wrote:
I have the following method:
def get_log_dates(the_date_we_want_data_for):
t = time.strptime(the_date_we_want_data_for, '%Y%m%d')
t2 = datetime.datetime(*t[:-2])
extra_day = datetime.timedelta(days=1)
t3 = t2 + extra_day
next_log_date = t3.strftime('%Y%m%d')
return (the_date_we_want_data_for, next_log_date)
Quite apart from not much liking the t[123] variables, does date
arithmetic really need to be this gnarly?
How could I improve the above, especially from a readability
perspective? Or is it ok?
Please in future provide a specification of the algorithm. What is is to
do. Saves me a lot of time trying to decipher the code.
--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor