I'm trying to make a function that will take an optional parameter, callback, which must be a function.
I'd like the default value for this function to be nothing - i.e. a function that does nothing. The way that seems to make sense to me is:
do_the_thing()
do_the_thing(callback = print) # or message.respond, or log_to_file, etc
def do_the_thing(**kwargs):
cb = kwargs.get('callback', lambda x: pass)
# do things
cb("Things have been done.")
But I get a syntax error at the end of "pass".
What's the correct way to go about this?