I have had a long standing unanswered question on on stackoverflow: is it possible to pass a function to a default parameter so that you could do in essence things like this.
def time_diff(target_time, curr_time= lambda : datetime.now() ): return curr_time - target_time this would be an syntactical improvement over this style where you have if statement to initialize a missing parameter. def time_diff(target_time, curr_time=None): if curr_time == None: curr_time = datetime.datetime.now() return curr_time - target_time _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/WQ365YOBQMHOYN6G6EU7L3YBZLPLUTG7/ Code of Conduct: http://python.org/psf/codeofconduct/