consider:
blank_fn = lambda *args, **kwargs: None
def callback(x, y, z=''):
print x, y, z
def perform_task(callback=blank_fn):
print 'doing stuff'
callback('x', 'y', z='z' )
The motivation for doing it this way is I don't have to put in logic to check if callback has been assigned because it defaults to blank_fn which just does nothing.
This works, but is there some reason I shouldn't do it? Is it pythonic? Is there a better way to do it? Is there a built-in for:
lambda *args, **kwargs: None