I sometimes find myself wanting to make placeholder 'do nothing' lambda expressions, similar to saying:
def do_nothing(*args):
pass
But the following syntax is illegal since lambda expressions attempt to return whatever is after the colon, and you can't return pass
.
do_nothing = lambda *args: pass
So I was wondering, would the following expression be a suitable replacement for the above?
do_nothing = lambda *args: None
Since the do_nothing
function above technically returns None
, is it okay to make a lambda expression that returns None
to use as a placeholder lambda expression? Or is it bad practice?