In the function main I have
def main():
#...
def button_callback(button,a, byMouse,label):
#...
date = date - oneday
while(date.isoweekday()>5): date = date -oneday
#...
oneday = datetime.timedelta(1)
date = datetime.date.today()
python complains: local variable 'date' referenced before assignment, which is expected. In other parts of main() I pay attention not to assign but to modify, thus I have for example
def main():
# other part of main()
def clear_callback( button,byMouse,aaa):
a_cats.clear()
a_cats = set(["GT","GR"])
which python is happy about (it woudn't be if I set e.g. a_cats = a_cats.clear() ).
Is there a way to modify a datetime object without explicitly using "=", so that I can avoid using global variables ?