I have a function that looks like this:
def getCurrentShow(hour=(localtime().tm_hour),day=datetime.datetime.now().strftime('%A')):
return Schedule.objects.get(hour=hour,day=day).show
so I can call it with or without a time or day. My problem is that when I call it with no arguments ie:
print getCurrentShow()
It always returns the same object when run from the same python instance(if I have a python shell running and I wait for an hour and start a new shell without quiting the old one for example, I can run it and get different results between the shells(or webserver) but the function always returns the same value once in the same shell).
I'm guessing python caches the results of functions called without arguments somehow? any way to get around this without rewriting all my calls to getCurrentShow to something like
Schedule.objects.get(hour=(localtime().tm_hour),day=datetime.datetime.now().strftime('%A')).show
?
Thanks.