You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isn't going to work right for long-running apps.
The default value for at_date gets saved when the function is parsed by the Python interpreter.
Thereafter, every invocation of get_sunrise_time() is going to use the same exact value for at_date.
You can see with this example:
from datetime import datetime
import time
def foo(when=datetime.now()):
return when
print(foo())
time.sleep(3)
print(foo())
which prints the exact same value twice, something like this:
Code like this:
isn't going to work right for long-running apps.
The default value for
at_date
gets saved when the function is parsed by the Python interpreter.Thereafter, every invocation of
get_sunrise_time()
is going to use the same exact value forat_date
.You can see with this example:
which prints the exact same value twice, something like this:
The fix is to do something like this:
The text was updated successfully, but these errors were encountered: