A suitable 'do nothing' lambda expression in python?

后端 未结 5 1778
遥遥无期
遥遥无期 2020-12-25 09:05

I sometimes find myself wanting to make placeholder \'do nothing\' lambda expressions, similar to saying:

def do_nothing(*args):
    pass

B

5条回答
  •  心在旅途
    2020-12-25 09:49

    This is the simplest lambda expression:

    do_nothing = lambda: None
    

    No arguments required and the minimal required return.

提交回复
热议问题